Skip to content

Commit d1c1102

Browse files
author
Alexej Yaroshevich
committed
Initial commit
0 parents  commit d1c1102

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# reserved-words
2+
3+
[![Build Status](https://secure.travis-ci.org/zxqfox/reserved-words.svg)](http://travis-ci.org/zxqfox/reserved-words)
4+
5+
## What is it?
6+
7+
Tiny package for detecting reserved words.
8+
9+
`Reserved Word` is either a `Keyword`, or a `Future Reserved Word`, or a `Null Literal`, or a `Boolean Literal`.
10+
See: [ES5 #7.6.1](http://es5.github.io/#x7.6.1) and
11+
[ES6 #11.6.2](http://www.ecma-international.org/ecma-262/6.0/#sec-reserved-words).
12+
13+
## Installation
14+
15+
```
16+
npm install reserved-words
17+
```
18+
19+
## API
20+
21+
### check(word, [dialect], [strict])
22+
23+
Returns `true` if provided identifier string is a Reserved Word
24+
in some ECMAScript dialect (ECMA-262 edition).
25+
26+
If the `strict` flag is truthy, this function additionally checks whether
27+
`word` is a Keyword or Future Reserved Word under strict mode.
28+
29+
### dialects
30+
31+
#### es3 (or 3)
32+
33+
Represents [ECMA-262 3rd edition](http://www.ecma-international.org/publications/files/ECMA-ST-ARCH/ECMA-262,%203rd%20edition,%20December%201999.pdf).
34+
35+
See section 7.5.1.
36+
37+
#### es5 (or 5)
38+
39+
Represents [ECMA-262 5th edition (ECMAScript 5.1)](http://es5.github.io/).
40+
41+
Reserved Words are formally defined in ECMA262 sections
42+
[7.6.1.1](http://es5.github.io/#x7.6.1.1) and [7.6.1.2](http://es5.github.io/#x7.6.1.2).
43+
44+
#### es2015 (or es6, 6)
45+
46+
Represents [ECMA-262 6th edition](ECMAScript 2015).
47+
48+
Reserved Words are formally defined in sections
49+
[11.6.2.1](http://ecma-international.org/ecma-262/6.0/#sec-keywords) and
50+
[11.6.2.2](http://ecma-international.org/ecma-262/6.0/#sec-future-reserved-words).
51+
52+
### License
53+
54+
Licensed under [The MIT License](https://github.com/zxqfox/reserved-words/blob/LICENSE)

0 commit comments

Comments
 (0)