Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Skipped
47 lines
2.0 KiB
Plaintext
47 lines
2.0 KiB
Plaintext
//#region src/utils/url.d.ts
|
|
/**
|
|
* @module
|
|
* URL utility.
|
|
*/
|
|
export type Pattern = readonly [string, string, RegExp | true] | '*';
|
|
export declare const splitPath: (path: string) => string[];
|
|
export declare const splitRoutingPath: (routePath: string) => string[];
|
|
export declare const getPattern: (label: string, next?: string) => Pattern | null;
|
|
type Decoder = (str: string) => string;
|
|
export declare const tryDecode: (str: string, decoder: Decoder) => string;
|
|
/**
|
|
* Try to apply decodeURI() to given string.
|
|
* If it fails, skip invalid percent encoding or invalid UTF-8 sequences, and apply decodeURI() to the rest as much as possible.
|
|
* @param str The string to decode.
|
|
* @returns The decoded string that sometimes contains undecodable percent encoding.
|
|
* @example
|
|
* tryDecodeURI('Hello%20World') // 'Hello World'
|
|
* tryDecodeURI('Hello%20World/%A4%A2') // 'Hello World/%A4%A2'
|
|
*/
|
|
export declare const tryDecodeURI: (str: string) => string;
|
|
export declare const getPath: (request: Request) => string;
|
|
/**
|
|
* @deprecated
|
|
* Use the `URL` API instead.
|
|
*/
|
|
export declare const getQueryStrings: (url: string) => string;
|
|
export declare const getPathNoStrict: (request: Request) => string;
|
|
/**
|
|
* Merge paths.
|
|
* @param {string[]} ...paths - The paths to merge.
|
|
* @returns {string} The merged path.
|
|
* @example
|
|
* mergePath('/api', '/users') // '/api/users'
|
|
* mergePath('/api/', '/users') // '/api/users'
|
|
* mergePath('/api', '/') // '/api'
|
|
* mergePath('/api/', '/') // '/api/'
|
|
*/
|
|
export declare const mergePath: (...paths: string[]) => string;
|
|
export declare const checkOptionalParameter: (path: string) => string[] | null;
|
|
export declare const tryDecodeURIComponent: (str: string) => string;
|
|
export declare const getQueryParam: (url: string, key?: string) => string | undefined | Record<string, string>;
|
|
export declare const getQueryParams: (url: string, key?: string) => string[] | undefined | Record<string, string[]>;
|
|
export declare const decodeURIComponent_: typeof decodeURIComponent;
|
|
//#endregion
|
|
export {};
|