@@ -35,41 +35,42 @@ export const createURLParams = <T extends Record<string, any>>(
35
35
return acc ;
36
36
}
37
37
const value =
38
- typeof curr === 'boolean'
39
- ? booleanMapper ( curr )
40
- : String ( curr ) ;
38
+ typeof curr === 'boolean' ? booleanMapper ( curr ) : String ( curr ) ;
41
39
return { ...acc , [ `${ keyPrefix } [${ i } ]` ] : value } ;
42
40
} , { } ) ;
43
41
}
44
42
45
- return Object . keys ( value ) . reduce ( ( acc : Record < string , string > , key : string ) => {
46
- const keyString = getKeyString ( keyPrefix , key , index ) ;
47
- const item = value [ key as keyof Record < string , string > ] ;
43
+ return Object . keys ( value ) . reduce (
44
+ ( acc : Record < string , string > , key : string ) => {
45
+ const keyString = getKeyString ( keyPrefix , key , index ) ;
46
+ const item = value [ key as keyof Record < string , string > ] ;
48
47
49
- if ( Array . isArray ( item ) ) {
50
- return {
51
- ...acc ,
52
- ...createURLParams ( item , {
53
- ...config ,
54
- keyPrefix : keyString ,
55
- } ) ,
56
- } ;
57
- }
48
+ if ( Array . isArray ( item ) ) {
49
+ return {
50
+ ...acc ,
51
+ ...createURLParams ( item , {
52
+ ...config ,
53
+ keyPrefix : keyString ,
54
+ } ) ,
55
+ } ;
56
+ }
58
57
59
- if ( item === null || item === undefined ) {
60
- return acc ;
61
- }
58
+ if ( item === null || item === undefined ) {
59
+ return acc ;
60
+ }
62
61
63
- if ( typeof item === 'boolean' ) {
64
- return { ...acc , [ `${ keyString } ` ] : booleanMapper ( item ) } ;
65
- }
62
+ if ( typeof item === 'boolean' ) {
63
+ return { ...acc , [ `${ keyString } ` ] : booleanMapper ( item ) } ;
64
+ }
66
65
67
- if ( typeof item === 'object' ) {
68
- return {
69
- ...acc ,
70
- ...createURLParams ( item , { ...config , keyPrefix : keyString } ) ,
71
- } ;
72
- }
73
- return { ...acc , [ `${ keyString } ` ] : String ( item ) } ;
74
- } , { } ) ;
66
+ if ( typeof item === 'object' ) {
67
+ return {
68
+ ...acc ,
69
+ ...createURLParams ( item , { ...config , keyPrefix : keyString } ) ,
70
+ } ;
71
+ }
72
+ return { ...acc , [ `${ keyString } ` ] : String ( item ) } ;
73
+ } ,
74
+ { }
75
+ ) ;
75
76
} ;
0 commit comments