File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ function isInt(value: any) {
66 Number ( value ) == value && ! isNaN ( parseInt ( value , 10 ) )
77}
88
9- export const arrayRegex = ( ) => / ^ ( [ a - z A - Z _ $ ] [ 0 - 9 a - z A - Z _ \- $ ] * ) \[ ( (? ! ( \] | \[ ) ) .* | ) \] $ / gm
9+ export const arrayRegex = ( ) => / ^ ( [ \. 0 - 9 a - z A - Z _ $ \- ] [ 0 - 9 a - z A - Z _ \- $ \. ] * ) \[ ( (? ! ( \] | \[ ) ) .* | ) \] $ / gm
1010const regexCache = { } as KeyValue
1111
1212export class ArrayInfo {
Original file line number Diff line number Diff line change @@ -481,6 +481,18 @@ describe('JsonDB', () => {
481481 }
482482 }
483483 )
484+ test ( 'should add array entry of array starting with number in name' , ( ) => {
485+ db . push ( '/arraytest/11_Dec[0]' , "test" , true )
486+ const myarray = db . getData ( '/arraytest/11_Dec' )
487+ expect ( myarray ) . toBeInstanceOf ( Array )
488+ expect ( myarray [ 0 ] ) . toBe ( 'test' )
489+ } )
490+ test ( 'should add array entry of array containg a dot (.) in name' , ( ) => {
491+ db . push ( '/arraytest/d.s_[0]' , "test" , true )
492+ const myarray = db . getData ( '/arraytest/d.s_' )
493+ expect ( myarray ) . toBeInstanceOf ( Array )
494+ expect ( myarray [ 0 ] ) . toBe ( 'test' )
495+ } )
484496 describe ( 'last item' , ( ) => {
485497
486498 test (
You can’t perform that action at this time.
0 commit comments