Provides a list of reserved identifiers for JavaScript
It assumes the latest JavaScript version (ES2023) and module context. Supporting older JavaScript versions is a non-goal.
npm install reserved-identifiers
import reservedIdentifiers from 'reserved-identifiers'; const identifiers = reservedIdentifiers(); const isReserved = identifier => identifiers.has(identifier); console.log(isReserved('await')); //=> true
Returns a Set with the identifiers.
Type: object
Type: boolean
Default: false
Include the global properties globalThis, Infinity, NaN, and undefined. Although not officially reserved, they should typically not be used as identifiers.
Returns a Set with TypeScript's built-in types that are reserved and cannot be used for type names (interfaces, type aliases, enums, classes, type parameters).
import {typeScriptReservedTypes} from 'reserved-identifiers'; const types = typeScriptReservedTypes(); console.log(types.has('any')); //=> true console.log(types.has('unknown')); //=> true