JSPM

reserved-identifiers

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 143330
  • Score
    100M100P100Q214713F
  • License MIT

Provides a list of reserved identifiers for JavaScript

Package Exports

  • reserved-identifiers

Readme

reserved-identifiers

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.

Install

npm install reserved-identifiers

Usage

import reservedIdentifiers from 'reserved-identifiers';

const identifiers = reservedIdentifiers();
const isReserved = identifier => identifiers.has(identifier);

console.log(isReserved('await'));
//=> true

API

reservedIdentifiers(options?)

Returns a Set with the identifiers.

options

Type: object

includeGlobalProperties

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.

  • is-identifier - Check if a string is a valid JavaScript identifier