(raw: string, allowReserved: boolean)
| 53 | const RESERVED_UNENCODED_RE = /[A-Za-z0-9\-._~:/?#[\]@!$&'()*+,;=]/; |
| 54 | |
| 55 | const encodeReservedAware = (raw: string, allowReserved: boolean): string => { |
| 56 | if (!allowReserved) return encodeURIComponent(raw); |
| 57 | // Walk char-by-char so the reserved set passes through as-is. |
| 58 | let out = ""; |
| 59 | for (const ch of raw) { |
| 60 | out += RESERVED_UNENCODED_RE.test(ch) ? ch : encodeURIComponent(ch); |
| 61 | } |
| 62 | return out; |
| 63 | }; |
| 64 | |
| 65 | type QueryParamEntry = readonly [name: string, value: string]; |
| 66 |
no outgoing calls
no test coverage detected