@@ -7,6 +7,11 @@ import {
77 type Style ,
88} from "./query-parser"
99
10+ // todo: nodejs v20 doesn't support Iterator.from - replace when v20 support dropped.
11+ function * toIterator < T > ( arr : T [ ] ) : IterableIterator < T > {
12+ yield * arr
13+ }
14+
1015describe ( "query-parser" , ( ) => {
1116 describe ( "#parseCsvPairsToObject" , ( ) => {
1217 it ( "parses a single pair" , ( ) => {
@@ -27,7 +32,7 @@ describe("query-parser", () => {
2732 const expected = [ "foo[0]" , "foo[1]" , "foo[2]" ]
2833 const actual = extractArrayNotationKeys (
2934 "foo" ,
30- Iterator . from ( [ "foo[0]" , "foo[2]" , "foo[1]" ] ) ,
35+ toIterator ( [ "foo[0]" , "foo[2]" , "foo[1]" ] ) ,
3136 )
3237
3338 expect ( actual ) . toEqual ( expected )
@@ -37,7 +42,7 @@ describe("query-parser", () => {
3742 const expected = [ "foo[bar][0]" , "foo[bar][1]" , "foo[bar][2]" ]
3843 const actual = extractArrayNotationKeys (
3944 "foo[bar]" ,
40- Iterator . from ( [ "foo[bar][0]" , "foo[bar][2]" , "foo[bar][1]" ] ) ,
45+ toIterator ( [ "foo[bar][0]" , "foo[bar][2]" , "foo[bar][1]" ] ) ,
4146 )
4247
4348 expect ( actual ) . toEqual ( expected )
@@ -47,7 +52,7 @@ describe("query-parser", () => {
4752 const expected : string [ ] = [ ]
4853 const actual = extractArrayNotationKeys (
4954 "foo" ,
50- Iterator . from ( [ "foo[bar]" , "foo[baz]" ] ) ,
55+ toIterator ( [ "foo[bar]" , "foo[baz]" ] ) ,
5156 )
5257
5358 expect ( actual ) . toEqual ( expected )
0 commit comments