@@ -11,18 +11,13 @@ import type {
11
11
MatcherPatternQuery ,
12
12
} from './new-matcher-pattern'
13
13
import { warn } from '../warning'
14
- import {
15
- SLASH_RE ,
16
- encodePath ,
17
- encodeQueryValue as _encodeQueryValue ,
18
- } from '../encoding'
14
+ import { encodeQueryValue as _encodeQueryValue } from '../encoding'
19
15
import { parseURL , stringifyURL } from '../location'
20
16
import type {
21
17
MatcherLocationAsNamed ,
22
18
MatcherLocationAsRelative ,
23
19
MatcherParamsFormatted ,
24
20
} from './matcher-location'
25
- import { RouteRecordRaw } from 'test-dts'
26
21
27
22
/**
28
23
* Allowed types for a matcher name.
@@ -165,20 +160,20 @@ interface FnStableNull {
165
160
( value : string | number | null | undefined ) : string | null
166
161
}
167
162
168
- function encodeParam ( text : null | undefined , encodeSlash ?: boolean ) : null
169
- function encodeParam ( text : string | number , encodeSlash ?: boolean ) : string
170
- function encodeParam (
171
- text : string | number | null | undefined ,
172
- encodeSlash ?: boolean
173
- ) : string | null
174
- function encodeParam (
175
- text : string | number | null | undefined ,
176
- encodeSlash = true
177
- ) : string | null {
178
- if ( text == null ) return null
179
- text = encodePath ( text )
180
- return encodeSlash ? text . replace ( SLASH_RE , '%2F' ) : text
181
- }
163
+ // function encodeParam(text: null | undefined, encodeSlash?: boolean): null
164
+ // function encodeParam(text: string | number, encodeSlash?: boolean): string
165
+ // function encodeParam(
166
+ // text: string | number | null | undefined,
167
+ // encodeSlash?: boolean
168
+ // ): string | null
169
+ // function encodeParam(
170
+ // text: string | number | null | undefined,
171
+ // encodeSlash = true
172
+ // ): string | null {
173
+ // if (text == null) return null
174
+ // text = encodePath(text)
175
+ // return encodeSlash ? text.replace(SLASH_RE, '%2F') : text
176
+ // }
182
177
183
178
// @ts -expect-error: overload are not correctly identified
184
179
const encodeQueryValue : FnStableNull =
@@ -190,23 +185,6 @@ const encodeQueryValue: FnStableNull =
190
185
// // for ts
191
186
// value => (value == null ? null : _encodeQueryKey(value))
192
187
193
- function transformObject < T > (
194
- fnKey : ( value : string | number ) => string ,
195
- fnValue : FnStableNull ,
196
- query : T
197
- ) : T {
198
- const encoded : any = { }
199
-
200
- for ( const key in query ) {
201
- const value = query [ key ]
202
- encoded [ fnKey ( key ) ] = Array . isArray ( value )
203
- ? value . map ( fnValue )
204
- : fnValue ( value as string | number | null | undefined )
205
- }
206
-
207
- return encoded
208
- }
209
-
210
188
export const NO_MATCH_LOCATION = {
211
189
name : __DEV__ ? Symbol ( 'no-match' ) : Symbol ( ) ,
212
190
params : { } ,
0 commit comments