11import { CharCode , isDigit } from './charCode.js'
2- import { CodableObject , CodableValue } from './types.js'
2+ import { DecodedObject , DecodedValue } from './types.js'
33
44type URLSearchParams = typeof globalThis extends {
55 URLSearchParams : infer T extends abstract new ( ...args : any ) => any
@@ -10,8 +10,8 @@ type URLSearchParams = typeof globalThis extends {
1010 get ( key : string ) : string | null
1111 }
1212
13- export function decode ( input : URLSearchParams ) : CodableObject {
14- const result : CodableObject = { }
13+ export function decode ( input : URLSearchParams ) : DecodedObject {
14+ const result : DecodedObject = { }
1515 let key : string | undefined
1616 try {
1717 for ( key of input . keys ( ) ) {
@@ -37,18 +37,18 @@ const enum ValueMode {
3737 String ,
3838}
3939
40- const constantsMap : Record < string , CodableValue > = {
40+ const constantsMap : Record < string , DecodedValue > = {
4141 null : null ,
4242 false : false ,
4343 true : true ,
4444}
4545
46- function decodeValue ( input : string , cursor = { pos : 0 } ) : CodableValue {
46+ function decodeValue ( input : string , cursor = { pos : 0 } ) : DecodedValue {
4747 const startPos = cursor . pos
4848 const nested = startPos > 0
4949
5050 let mode : number = ValueMode . Unknown
51- let result : CodableValue
51+ let result : DecodedValue | undefined
5252
5353 let pos = startPos
5454 let charCode = input . charCodeAt ( pos )
@@ -139,7 +139,7 @@ function decodeValue(input: string, cursor = { pos: 0 }): CodableValue {
139139 }
140140
141141 case ValueMode . Array : {
142- const array : CodableValue [ ] = [ ]
142+ const array : DecodedValue [ ] = [ ]
143143
144144 while ( ++ pos < input . length ) {
145145 charCode = input . charCodeAt ( pos )
@@ -166,7 +166,7 @@ function decodeValue(input: string, cursor = { pos: 0 }): CodableValue {
166166 }
167167
168168 case ValueMode . Object : {
169- const object : CodableObject = { }
169+ const object : DecodedObject = { }
170170 let key = ''
171171 let keyPos = pos + 1
172172 let open = true
0 commit comments