File tree Expand file tree Collapse file tree 4 files changed +6
-61
lines changed Expand file tree Collapse file tree 4 files changed +6
-61
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- import { start as startRe , cont as contRe } from './regex.js'
1
+ const startRe = / [ $ _ \p{ ID_Start} ] / u
2
+ const contRe = / [ $ _ \u{200C} \u{200D} \p{ ID_Continue} ] / u
3
+ const re = / ^ [ $ _ \p{ ID_Start} ] [ $ _ \u{200C} \u{200D} \p{ ID_Continue} ] * $ / u
2
4
3
5
/**
4
6
* Checks if the given character code can start an identifier.
@@ -23,8 +25,7 @@ export function start(code) {
23
25
*/
24
26
// To do: support astrals.
25
27
export function cont ( code ) {
26
- const character = String . fromCharCode ( code )
27
- return startRe . test ( character ) || contRe . test ( character )
28
+ return contRe . test ( String . fromCharCode ( code ) )
28
29
}
29
30
30
31
/**
@@ -36,12 +37,5 @@ export function cont(code) {
36
37
* Whether `name` can be an identifier.
37
38
*/
38
39
export function name ( name ) {
39
- let index = - 1
40
-
41
- while ( ++ index < name . length ) {
42
- if ( ! ( index ? cont : start ) ( name . charCodeAt ( index ) ) ) return false
43
- }
44
-
45
- // `false` if `name` is empty.
46
- return index > 0
40
+ return re . test ( name )
47
41
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 33
33
],
34
34
"devDependencies" : {
35
35
"@types/node" : " ^20.0.0" ,
36
- "@types/regenerate" : " ^1.0.0" ,
37
- "@unicode/unicode-15.0.0" : " ^1.0.0" ,
38
36
"c8" : " ^8.0.0" ,
39
37
"prettier" : " ^3.0.0" ,
40
- "regenerate" : " ^1.0.0" ,
41
38
"remark-cli" : " ^11.0.0" ,
42
39
"remark-preset-wooorm" : " ^9.0.0" ,
43
40
"type-coverage" : " ^2.0.0" ,
46
43
},
47
44
"scripts" : {
48
45
"prepack" : " npm run build && npm run format" ,
49
- "generate" : " node --conditions development build.js" ,
50
46
"build" : " tsc --build --clean && tsc --build && type-coverage" ,
51
47
"format" : " remark . -qfo && prettier . -w --log-level warn && xo --fix" ,
52
48
"test-api" : " node --conditions development test.js" ,
53
49
"test-coverage" : " c8 --check-coverage --100 --reporter lcov npm run test-api" ,
54
- "test" : " npm run generate && npm run build && npm run format && npm run test-coverage"
50
+ "test" : " npm run build && npm run format && npm run test-coverage"
55
51
},
56
52
"prettier" : {
57
53
"tabWidth" : 2 ,
You can’t perform that action at this time.
0 commit comments