1
1
import { CharCode , isDigit } from './charCode.js'
2
- import { CodableObject , CodableValue } from './types.js'
2
+ import { DecodedObject , DecodedValue } from './types.js'
3
3
4
4
type URLSearchParams = typeof globalThis extends {
5
5
URLSearchParams : infer T extends abstract new ( ...args : any ) => any
@@ -10,8 +10,8 @@ type URLSearchParams = typeof globalThis extends {
10
10
get ( key : string ) : string | null
11
11
}
12
12
13
- export function decode ( input : URLSearchParams ) : CodableObject {
14
- const result : CodableObject = { }
13
+ export function decode ( input : URLSearchParams ) : DecodedObject {
14
+ const result : DecodedObject = { }
15
15
let key : string | undefined
16
16
try {
17
17
for ( key of input . keys ( ) ) {
@@ -37,18 +37,18 @@ const enum ValueMode {
37
37
String ,
38
38
}
39
39
40
- const constantsMap : Record < string , CodableValue > = {
40
+ const constantsMap : Record < string , DecodedValue > = {
41
41
null : null ,
42
42
false : false ,
43
43
true : true ,
44
44
}
45
45
46
- function decodeValue ( input : string , cursor = { pos : 0 } ) : CodableValue {
46
+ function decodeValue ( input : string , cursor = { pos : 0 } ) : DecodedValue {
47
47
const startPos = cursor . pos
48
48
const nested = startPos > 0
49
49
50
50
let mode : number = ValueMode . Unknown
51
- let result : CodableValue
51
+ let result : DecodedValue | undefined
52
52
53
53
let pos = startPos
54
54
let charCode = input . charCodeAt ( pos )
@@ -139,7 +139,7 @@ function decodeValue(input: string, cursor = { pos: 0 }): CodableValue {
139
139
}
140
140
141
141
case ValueMode . Array : {
142
- const array : CodableValue [ ] = [ ]
142
+ const array : DecodedValue [ ] = [ ]
143
143
144
144
while ( ++ pos < input . length ) {
145
145
charCode = input . charCodeAt ( pos )
@@ -166,7 +166,7 @@ function decodeValue(input: string, cursor = { pos: 0 }): CodableValue {
166
166
}
167
167
168
168
case ValueMode . Object : {
169
- const object : CodableObject = { }
169
+ const object : DecodedObject = { }
170
170
let key = ''
171
171
let keyPos = pos + 1
172
172
let open = true
0 commit comments