File tree 5 files changed +42
-42
lines changed
5 files changed +42
-42
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ const startRe = regenerate().add(start).toRegExp()
20
20
const contRe = regenerate ( ) . add ( cont ) . remove ( start ) . toRegExp ( )
21
21
22
22
fs . writeFileSync (
23
- path . join ( 'regex.js' ) ,
23
+ path . join ( 'lib' , ' regex.js') ,
24
24
[
25
25
'// This module is generated by `build.js`.' ,
26
26
'export const start = ' + startRe ,
Original file line number Diff line number Diff line change 1
- import { start as startRe , cont as contRe } from './regex.js'
2
-
3
- /**
4
- * Checks if the given character code can start an identifier.
5
- *
6
- * @param {number } code
7
- */
8
- // To do: support astrals.
9
- export function start ( code ) {
10
- return startRe . test ( String . fromCharCode ( code ) )
11
- }
12
-
13
- /**
14
- * Checks if the given character code can continue an identifier.
15
- *
16
- * @param {number } code
17
- */
18
- // To do: support astrals.
19
- export function cont ( code ) {
20
- const character = String . fromCharCode ( code )
21
- return startRe . test ( character ) || contRe . test ( character )
22
- }
23
-
24
- /**
25
- * Checks if the given string is a valid identifier name.
26
- *
27
- * @param {string } name
28
- */
29
- export function name ( name ) {
30
- let index = - 1
31
-
32
- while ( ++ index < name . length ) {
33
- if ( ! ( index ? cont : start ) ( name . charCodeAt ( index ) ) ) return false
34
- }
35
-
36
- // `false` if `name` is empty.
37
- return index > 0
38
- }
1
+ export { cont , name , start } from './lib/index.js'
Original file line number Diff line number Diff line change
1
+ import { start as startRe , cont as contRe } from './regex.js'
2
+
3
+ /**
4
+ * Checks if the given character code can start an identifier.
5
+ *
6
+ * @param {number } code
7
+ */
8
+ // To do: support astrals.
9
+ export function start ( code ) {
10
+ return startRe . test ( String . fromCharCode ( code ) )
11
+ }
12
+
13
+ /**
14
+ * Checks if the given character code can continue an identifier.
15
+ *
16
+ * @param {number } code
17
+ */
18
+ // To do: support astrals.
19
+ export function cont ( code ) {
20
+ const character = String . fromCharCode ( code )
21
+ return startRe . test ( character ) || contRe . test ( character )
22
+ }
23
+
24
+ /**
25
+ * Checks if the given string is a valid identifier name.
26
+ *
27
+ * @param {string } name
28
+ */
29
+ export function name ( name ) {
30
+ let index = - 1
31
+
32
+ while ( ++ index < name . length ) {
33
+ if ( ! ( index ? cont : start ) ( name . charCodeAt ( index ) ) ) return false
34
+ }
35
+
36
+ // `false` if `name` is empty.
37
+ return index > 0
38
+ }
File renamed without changes.
Original file line number Diff line number Diff line change 27
27
"main" : " index.js" ,
28
28
"types" : " index.d.ts" ,
29
29
"files" : [
30
+ " lib/" ,
30
31
" index.d.ts" ,
31
- " index.js" ,
32
- " regex.d.ts" ,
33
- " regex.js"
32
+ " index.js"
34
33
],
35
34
"devDependencies" : {
36
35
"@types/regenerate" : " ^1.0.0" ,
You can’t perform that action at this time.
0 commit comments