{"_id":"identifier-regex","_rev":"3-dc2fdf7ed8f9517436012c3bf06d48f8","name":"identifier-regex","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"identifier-regex","version":"1.0.0","keywords":["identifier","regex","regexp","regular","expression","keyword","word","reserved","javascript","ecmascript"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"identifier-regex@1.0.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/identifier-regex#readme","bugs":{"url":"https://github.com/sindresorhus/identifier-regex/issues"},"dist":{"shasum":"b9fc92aecfe3d9f3b427fd5af0d2e663163fcbef","tarball":"https://registry.npmjs.org/identifier-regex/-/identifier-regex-1.0.0.tgz","fileCount":5,"integrity":"sha512-Rcy5cjBOM9iTR+Vwy0Llyip9u0cA99T1yiWOhDW/+PDaTQhyski0tMovsipQ/FRNDkudjLWusJ/IMVIlG5WZnQ==","signatures":[{"sig":"MEYCIQC6OBP1KgnlyZ2UUf/U8fp0gsYC2/w8a10mZQIjL+SvuAIhAMfaKjwR69S+Uky/mN8D5MNJYgs2AEkBQtngqcJP2zPg","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4377},"type":"module","types":"./index.d.ts","engines":{"node":">=18"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"03d68b126589b7e86a3c10c9c7c8d2e05cebf136","scripts":{"test":"xo && ava"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/identifier-regex.git","type":"git"},"_npmVersion":"10.6.0","description":"Regular expression for matching JavaScript identifiers","directories":{},"sideEffects":false,"_nodeVersion":"20.12.2","dependencies":{"reserved-identifiers":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^0.58.0","ava":"^6.1.2"},"_npmOperationalInternal":{"tmp":"tmp/identifier-regex_1.0.0_1714932848282_0.543222216913434","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"identifier-regex","version":"1.0.1","keywords":["identifier","regex","regexp","regular","expression","keyword","word","reserved","javascript","ecmascript"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"identifier-regex@1.0.1","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/identifier-regex#readme","bugs":{"url":"https://github.com/sindresorhus/identifier-regex/issues"},"dist":{"shasum":"65fc1c16eebad54adcbec7eb9c99e8a926adfd29","tarball":"https://registry.npmjs.org/identifier-regex/-/identifier-regex-1.0.1.tgz","fileCount":5,"integrity":"sha512-ZrYyM0sozNPZlvBvE7Oq9Bn44n0qKGrYu5sQ0JzMUnjIhpgWYE2JB6aBoFwEYdPjqj7jPyxXTMJiHDOxDfd8yw==","signatures":[{"sig":"MEUCIAvr0Km+57OFDwou9Smsn4ipPm8EK74f+S23MiX/UqChAiEApOHUk52MkwdIIsj7526KlbIsaPgSduI85c9Pcb2TdVQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4445},"type":"module","types":"./index.d.ts","engines":{"node":">=18"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"2d400947acd1c05dd85108dc2e35d32f68ec53d8","scripts":{"test":"xo && ava"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/identifier-regex.git","type":"git"},"_npmVersion":"10.9.2","description":"Regular expression for matching JavaScript identifiers","directories":{},"sideEffects":false,"_nodeVersion":"20.19.1","dependencies":{"reserved-identifiers":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^0.58.0","ava":"^6.1.2"},"_npmOperationalInternal":{"tmp":"tmp/identifier-regex_1.0.1_1757759841592_0.11715930482953874","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"identifier-regex","version":"1.1.0","description":"Regular expression for matching JavaScript identifiers","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/identifier-regex.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava"},"keywords":["identifier","regex","regexp","regular","expression","keyword","word","reserved","javascript","ecmascript"],"dependencies":{"reserved-identifiers":"^1.0.0"},"devDependencies":{"ava":"^6.1.2","xo":"^0.58.0"},"gitHead":"637e9cf20693499d4337213a508f404490404df0","types":"./index.d.ts","_id":"identifier-regex@1.1.0","bugs":{"url":"https://github.com/sindresorhus/identifier-regex/issues"},"homepage":"https://github.com/sindresorhus/identifier-regex#readme","_nodeVersion":"22.22.3","_npmVersion":"11.18.0","dist":{"integrity":"sha512-SLX4H/vtcYlYnL7XqnuJKHU7Z8517TgsW9nmQiGOgMCjQ8V/deLYu6bEmbGoXe7WMMhc9+EUGyFFneHja8KabA==","shasum":"042abfaf28db15223436661f3b9ec882649f6ef0","tarball":"https://registry.npmjs.org/identifier-regex/-/identifier-regex-1.1.0.tgz","fileCount":5,"unpackedSize":5717,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAtNzhxccS7PS+j9Rq3lU9j4y+EVPD544Jk0ZXo9jWrFAiAwrsdLj9rLIYRbaH9rSemQepZUbZVdM25Te7syJ7emQQ=="}]},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/identifier-regex_1.1.0_1783209819747_0.15671401403949892"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-05T18:14:08.281Z","modified":"2026-07-05T00:03:40.018Z","1.0.0":"2024-05-05T18:14:08.435Z","1.0.1":"2025-09-13T10:37:21.783Z","1.1.0":"2026-07-05T00:03:39.909Z"},"bugs":{"url":"https://github.com/sindresorhus/identifier-regex/issues"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","homepage":"https://github.com/sindresorhus/identifier-regex#readme","keywords":["identifier","regex","regexp","regular","expression","keyword","word","reserved","javascript","ecmascript"],"repository":{"type":"git","url":"git+https://github.com/sindresorhus/identifier-regex.git"},"description":"Regular expression for matching JavaScript identifiers","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"readme":"# identifier-regex\n\n> Regular expression for matching valid [JavaScript identifiers](https://developer.mozilla.org/en-US/docs/Glossary/Identifier)\n\n## Install\n\n```sh\nnpm install identifier-regex\n```\n\n## Usage\n\n```js\nimport identifierRegex from 'identifier-regex';\n\nidentifierRegex().test('foo');\n//=> true\n\nidentifierRegex().test('1kg');\n//=> false\n\nidentifierRegex().test('await'); // Reserved identifier\n//=> false\n\n'@x $x #x'.match(identifierRegex({exact: false}));\n//=> ['$x']\n```\n\n> [!IMPORTANT]\n> If you run the regex against untrusted user input in a server context, you should [give it a timeout](https://github.com/sindresorhus/super-regex). I do not consider ReDoS a valid vulnerability for this package.\n\n> [!NOTE]\n> Although `globalThis`, `Infinity`, `NaN`, and `undefined` are [properties of the global object](https://tc39.es/ecma262/#sec-value-properties-of-the-global-object) and not identifiers, they are not matched by the regex because they should generally not be used as identifiers.\n\n## API\n\n### identifierRegex(options?)\n\nReturns a `RegExp` for matching valid JavaScript identifiers.\n\n#### options\n\nType: `object`\n\n##### exact\n\nType: `boolean`\\\nDefault: `true`\n\nOnly match an exact string.\n\n##### checkReserved\n\nType: `boolean`\\\nDefault: `true`\n\nReject reserved words and global properties like `if`, `await`, and `undefined`.\n\nThese are valid identifier syntax but should not be used as variable names, so they are rejected by default. Disable this when you only care about the syntax, such as for property keys (`{if: 1}`) or dot notation (`foo.for`), where they are allowed.\n\n```js\nimport identifierRegex from 'identifier-regex';\n\nidentifierRegex({checkReserved: false}).test('for');\n//=> true\n```\n\n## Related\n\n- [is-identifier](https://github.com/sindresorhus/is-identifier) - Check if a string is a valid JavaScript identifier\n","readmeFilename":"readme.md"}