Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reserved-words

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reserved-words

ECMAScript reserved words checker

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is reserved-words?

The 'reserved-words' npm package is used to check if a given word is a reserved keyword in JavaScript or other ECMAScript versions. This can be useful for validating identifiers in code generation, linting, or other scenarios where you need to ensure that certain words are not used as variable names or other identifiers.

What are reserved-words's main functionalities?

Check if a word is reserved in a specific ECMAScript version

This feature allows you to check if a given word is a reserved keyword in a specific ECMAScript version. In this example, 'class' is checked against ECMAScript 6 (ES6) and returns true because 'class' is a reserved keyword in ES6.

const reservedWords = require('reserved-words');
const isReserved = reservedWords.check('class', 6); // true for ES6
console.log(isReserved);

Check if a word is reserved in multiple ECMAScript versions

This feature allows you to check if a given word is reserved in multiple ECMAScript versions at once. In this example, 'class' is checked against ES3, ES5, and ES6, and returns true because 'class' is a reserved keyword in ES6.

const reservedWords = require('reserved-words');
const isReserved = reservedWords.check('class', [3, 5, 6]); // true for ES3, ES5, and ES6
console.log(isReserved);

Get a list of reserved words for a specific ECMAScript version

This feature allows you to get a list of all reserved words for a specific ECMAScript version. In this example, it retrieves the list of reserved words for ES6.

const reservedWords = require('reserved-words');
const reservedList = reservedWords.list(6);
console.log(reservedList);

Other packages similar to reserved-words

Keywords

FAQs

Package last updated on 12 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc