Skip to content

Commit

Permalink
refactor: re-use reserved names set
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Dec 16, 2021
1 parent 2e91c85 commit 2bcd6e9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/utils/identifierHelpers.ts
@@ -1,13 +1,11 @@
export const reservedWords =
'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public'.split(
' '
);
import { RESERVED_NAMES } from './reservedNames';

const builtins =
'Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl'.split(
' '
);

const blacklisted = new Set(reservedWords.concat(builtins));
const blacklisted = new Set(...RESERVED_NAMES, builtins);

const illegalCharacters = /[^$_a-zA-Z0-9]/g;

Expand Down

0 comments on commit 2bcd6e9

Please sign in to comment.