Kestrel Print’s backup check now runs in JavaScript. On the new server, where nobody set BACKUP_BUCKET, backup-check.js refuses to start and exits with status 1, as the Python check does, instead of backing up to a bucket called undefined. In all three runs, it prints the same lines as Python, except that the debug line says string where Python says str.
You can now:
- Declare each name once, with
constby default andletonly for a name the code reassigns - Declare a name at the level where it’s read, because a
letorconstdeclaration inside braces lives only inside them - Check a value’s type with
typeofand spot an array withArray.isArray() - Tell
nullfromundefinedand catch either with== null - Test for an empty array with
.length === 0and an empty plain object withObject.keys(obj).length === 0, since both are truthy even when empty - Convert text with
Number()once and compare with===
Keep and Drop Your Python Habits
You ported most of the check without changing its logic. process.env.NAME does the job of os.environ.get(), but an unset variable gives undefined where Python gives None. An empty string is falsy in both languages, so if (!notifyEmail) warns as if not notify_email: does.