(segment: string)
| 3 | // decoding the rest of the path |
| 4 | const SEGMENT_RESERVED_CHARS = /%|\//g; |
| 5 | export function normalizeSegment(segment: string): string { |
| 6 | if (segment.length < 3 || !segment.includes("%")) return segment; |
| 7 | return decodeURIComponent(segment).replace( |
| 8 | SEGMENT_RESERVED_CHARS, |
| 9 | encodeURIComponent |
| 10 | ); |
| 11 | } |
| 12 | |
| 13 | // We do not want to encode these characters when generating dynamic path segments |
| 14 | // See https://tools.ietf.org/html/rfc3986#section-3.3 |
no outgoing calls
no test coverage detected
searching dependent graphs…