File tree Expand file tree Collapse file tree 2 files changed +15
-13
lines changed Expand file tree Collapse file tree 2 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export const normalizeRange = (
8
8
9
9
if ( range >= 0 ) return [ 0 , range ] ;
10
10
11
- return [ limit - Math . abs ( range ) , limit ] ;
11
+ return [ limit + 1 - Math . abs ( range ) , limit ] ;
12
12
} ;
13
13
14
14
export const within = (
Original file line number Diff line number Diff line change @@ -27,21 +27,23 @@ export type RootCharacterNode = {
27
27
const parseToCharacters = ( value : string ) : RootCharacterNode => {
28
28
let digits = 0 ;
29
29
30
+ const children = value . split ( '' ) . map ( ( character : string ) : DigitCharacterNode | OtherCharacterNode => {
31
+ if ( DIGIT . test ( character ) )
32
+ return {
33
+ character,
34
+ kind : 'digit' ,
35
+ digit : ++ digits , // It returns the incremented value of 'digits'.
36
+ } ;
37
+ return {
38
+ character,
39
+ kind : 'other' ,
40
+ } ;
41
+ } ) ;
42
+
30
43
return {
31
44
digits,
45
+ children,
32
46
kind : 'root' ,
33
- children : value . split ( '' ) . map ( ( character , index ) =>
34
- DIGIT . test ( character )
35
- ? {
36
- character,
37
- kind : 'digit' ,
38
- digit : ++ digits , // It returns the incremented value of 'digits'.
39
- }
40
- : {
41
- character,
42
- kind : 'other' ,
43
- }
44
- ) ,
45
47
} ;
46
48
} ;
47
49
You can’t perform that action at this time.
0 commit comments