first commit

This commit is contained in:
CrazyJasonwell
2026-07-23 20:36:13 +08:00
commit 513b68be8c
7915 changed files with 2642530 additions and 0 deletions
@@ -0,0 +1,15 @@
'use strict';
function safeProperty(test, name, type, defaultValue) {
if (test == null || test == undefined) return defaultValue;
if (typeof test[name] !== type) return defaultValue;
if (typeof test[name] === "string" && test[name] === '') return defaultValue;
return test[name];
}
function safeChoice(test, candidates, defaultValue) {
return candidates.includes(test) ?
test : defaultValue;
}
module.exports = { safeProperty, safeChoice };