1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const identifierRegex = /^[a-z$_][$\w]*$/i;
|
4 | const reservedSet = new Set([
|
5 | 'undefined',
|
6 | 'null',
|
7 | 'true',
|
8 | 'false',
|
9 | 'super',
|
10 | 'this',
|
11 | 'Infinity',
|
12 | 'NaN'
|
13 | ]);
|
14 | /**
|
15 | Test if the string is a valid JavaScript identifier.
|
16 |
|
17 | @param string - String to test.
|
18 | */
|
19 | exports.default = (string) => string && !reservedSet.has(string) && identifierRegex.test(string);
|