reserved2
Version:
Reserved words that may not be used as variables, functions, methods, or object identifiers, since ECMAScript specifies special behavior for them.
37 lines (32 loc) • 2.34 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Reserved2 = {}));
})(this, (function (exports) { 'use strict';
const reserved = /*#__PURE__*/Object.freeze(['abstract', 'arguments', 'boolean', 'break', 'byte', 'case', 'catch', 'char', 'class', 'const', 'continue', 'debugger', 'default', 'delete', 'do', 'double', 'else', 'enum', 'eval', 'export', 'extends', 'false', 'final', 'finally', 'float', 'for', 'function', 'goto', 'if', 'implements', 'import', 'in', 'instanceof', 'int', 'interface', 'let', 'long', 'native', 'new', 'null', 'package', 'private', 'protected', 'public', 'return', 'short', 'static', 'super', 'switch', 'synchronized', 'this', 'throw', 'throws', 'transient', 'true', 'try', 'typeof', 'var', 'void', 'volatile', 'while', 'with', 'yield']);
/**
* @see https://github.com/jonschlinkert/reserved
*/
const builtins = /*#__PURE__*/Object.freeze(['Array', 'Date', 'eval', 'function', 'hasOwnProperty', 'Infinity', 'isFinite', 'isNaN', 'isPrototypeOf', 'length', 'Math', 'name', 'NaN', 'Number', 'Object', 'prototype', 'String', 'toString', 'undefined', 'valueOf']);
const mixinReservedBuiltins = /*#__PURE__*/Object.freeze([...reserved, ...builtins]);
const mixinReservedBuiltinsLC = /*#__PURE__*/Object.freeze( /*#__PURE__*/mixinReservedBuiltins.map(s => s.toLowerCase()));
function containReservedOrBuiltins(input) {
return mixinReservedBuiltins.indexOf(input) !== -1;
}
function isReservedOrBuiltins(input) {
return mixinReservedBuiltins.includes(input);
}
function isReservedOrBuiltinsLC(input) {
return mixinReservedBuiltinsLC.includes(input);
}
exports.builtins = builtins;
exports.containReservedOrBuiltins = containReservedOrBuiltins;
exports.default = mixinReservedBuiltins;
exports.isReservedOrBuiltins = isReservedOrBuiltins;
exports.isReservedOrBuiltinsLC = isReservedOrBuiltinsLC;
exports.mixinReservedBuiltins = mixinReservedBuiltins;
exports.mixinReservedBuiltinsLC = mixinReservedBuiltinsLC;
exports.reserved = reserved;
Object.defineProperty(exports, '__esModule', { value: true });
}));
//# sourceMappingURL=index.umd.development.cjs.map