`reserved-identifiers` is a JavaScript library that provides a comprehensive `Set` of reserved identifiers according to the latest ECMAScript specification (currently ES2023) and module context. It offers a straightforward API to retrieve these identifiers, making it easy to check if a given string is reserved in modern JavaScript environments. The library also includes a dedicated export for TypeScript's built-in reserved types, useful for tooling that needs to validate type names. Maintained by Sindresorhus, the package typically sees stable, infrequent releases focused on incorporating new ECMAScript specifications or minor feature enhancements like the recent addition of TypeScript reserved types in v1.1.0 and strict mode identifiers in v1.2.0. Its primary differentiator is its strict adherence to modern JavaScript standards, intentionally omitting support for older JS versions. This focus ensures accuracy for current development practices, distinguishing it from libraries that might cater to a wider range of historical JS versions. The current stable version is 1.2.0.
npm install reserved-identifiersVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing both default and named exports, checking JavaScript reserved identifiers (with and without global properties), and checking TypeScript reserved types.
Ensure your target environment supports ES2023 and ESM, or use a different library if older JavaScript compatibility is required.
To include these in the returned set, initialize the set with `reservedIdentifiers({ includeGlobalProperties: true })`.Upgrade to `reserved-identifiers@^1.1.0` or higher to utilize the `typeScriptReservedTypes` export.
Review code that relies on `isReserved` checks for compatibility, as more identifiers might now be flagged as reserved in applications upgrading from older versions.
Use ESM `import` syntax: `import reservedIdentifiers from 'reserved-identifiers';`
Use the correct default import syntax: `import reservedIdentifiers from 'reserved-identifiers';`
Upgrade the package to `reserved-identifiers@^1.1.0` or higher using `npm install reserved-identifiers@latest`.
No dependency data recorded yet.