17
17
* [ Install] ( #install )
18
18
* [ Use] ( #use )
19
19
* [ API] ( #api )
20
- * [ ` name(value) ` ] ( #namevalue )
21
- * [ ` start(code) ` ] ( #startcode )
22
20
* [ ` cont(code) ` ] ( #contcode )
21
+ * [ ` name(name) ` ] ( #namename )
22
+ * [ ` start(code) ` ] ( #startcode )
23
23
* [ Types] ( #types )
24
24
* [ Compatibility] ( #compatibility )
25
25
* [ Related] ( #related )
@@ -39,7 +39,7 @@ You can use this utility when generating IDs from strings or parsing IDs.
39
39
## Install
40
40
41
41
This package is [ ESM only] [ esm ] .
42
- In Node.js (version 12.20+, 14.14+, 16.0+, or 18 .0+), install with [ npm] [ ] :
42
+ In Node.js (version 14.14+ and 16 .0+), install with [ npm] [ ] :
43
43
44
44
``` sh
45
45
npm install estree-util-is-identifier-name
@@ -62,7 +62,7 @@ In browsers with [`esm.sh`][esmsh]:
62
62
## Use
63
63
64
64
``` js
65
- import {name , start , cont } from ' estree-util-is-identifier-name'
65
+ import {cont , name , start } from ' estree-util-is-identifier-name'
66
66
67
67
name (' $something69' ) // => true
68
68
name (' 69' ) // => false
@@ -74,22 +74,48 @@ cont(48) // => true (character code for `0`)
74
74
75
75
## API
76
76
77
- This package exports the identifiers ` name ` , ` start ` , and ` cont ` .
77
+ This package exports the identifiers [ ` cont ` ] [ cont ] , [ ` name ` ] [ name ] , and
78
+ [ ` start ` ] [ start ] .
78
79
There is no default export.
79
80
80
- ### ` name(value) `
81
+ ### ` cont(code) `
82
+
83
+ Checks if the given character code can continue an identifier.
84
+
85
+ ###### Parameters
86
+
87
+ * ` code ` (` number ` )
88
+ — character code to check
89
+
90
+ ###### Returns
91
+
92
+ Whether ` code ` can continue an identifier (` boolean ` ).
93
+
94
+ ### ` name(name) `
95
+
96
+ Checks if the given value is a valid identifier name.
81
97
82
- Checks if ` value ` (` string ` ) is a valid identifier name (` boolean ` ).
98
+ ###### Parameters
99
+
100
+ * ` name ` (` string ` )
101
+ — identifier to check
102
+
103
+ ###### Returns
104
+
105
+ Whether ` name ` can be an identifier (` boolean ` ).
83
106
84
107
### ` start(code) `
85
108
86
- Checks if the given character code (` number ` ) can start an identifier
87
- (` boolean ` ).
109
+ Checks if the given character code can start an identifier.
88
110
89
- ### ` cont(code) `
111
+ ###### Parameters
112
+
113
+ * ` code ` (` number ` )
114
+ — character code to check
90
115
91
- Checks if the given character code (` number ` ) can continue an identifier
92
- (` boolean ` ).
116
+ ###### Returns
117
+
118
+ Whether ` code ` can start an identifier (` boolean ` ).
93
119
94
120
## Types
95
121
@@ -100,7 +126,7 @@ It exports no additional types.
100
126
101
127
Projects maintained by the unified collective are compatible with all maintained
102
128
versions of Node.js.
103
- As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18 .0+.
129
+ As of now, that is Node.js 14.14+ and 16 .0+.
104
130
Our projects sometimes work with older versions, but this is not guaranteed.
105
131
106
132
## Related
@@ -171,3 +197,9 @@ abide by its terms.
171
197
[ coc ] : https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
172
198
173
199
[ estree ] : https://github.com/estree/estree
200
+
201
+ [ cont ] : #contcode
202
+
203
+ [ name ] : #namename
204
+
205
+ [ start ] : #startcode
0 commit comments