typia
Version:
Superfast runtime validators with only one line
52 lines (50 loc) • 858 B
JavaScript
var Escaper;
(function (Escaper) {
Escaper.variable = (str) => Escaper.reserved(str) === false && /^[a-zA-Z_$][a-zA-Z_$0-9]*$/g.test(str);
Escaper.reserved = (str) => RESERVED.has(str);
})(Escaper || (Escaper = {}));
const RESERVED = new Set([
"break",
"case",
"catch",
"class",
"const",
"continue",
"debugger",
"default",
"delete",
"do",
"else",
"enum",
"export",
"extends",
"false",
"finally",
"for",
"function",
"if",
"import",
"in",
"instanceof",
"module",
"new",
"null",
"package",
"public",
"private",
"protected",
"return",
"super",
"switch",
"this",
"throw",
"true",
"try",
"typeof",
"var",
"void",
"while",
"with",
]);
export { Escaper };
//# sourceMappingURL=Escaper.mjs.map