1 |
|
2 |
|
3 |
|
4 | export interface RegExpOptions {
|
5 | sensitive?: boolean;
|
6 | strict?: boolean;
|
7 | end?: boolean;
|
8 | delimiter?: string;
|
9 | delimiters?: string | string[];
|
10 | endsWith?: string | string[];
|
11 | }
|
12 | export interface ParseOptions {
|
13 | delimiter?: string;
|
14 | delimiters?: string | string[];
|
15 | }
|
16 | export interface Key {
|
17 | name: string | number;
|
18 | prefix: string | null;
|
19 | delimiter: string | null;
|
20 | optional: boolean;
|
21 | repeat: boolean;
|
22 | pattern: string | null;
|
23 | partial: boolean;
|
24 | }
|
25 | export interface PathFunctionOptions {
|
26 | encode?: (value: string) => string;
|
27 | }
|
28 | export declare type Token = string | Key;
|
29 | export declare type Path = string | RegExp | Array<string | RegExp>;
|
30 | export declare type PathFunction = (data?: {
|
31 | [key: string]: any;
|
32 | }, options?: PathFunctionOptions) => string;
|
33 |
|
34 |
|
35 |
|
36 | export declare const parse: (str: string, options?: ParseOptions | undefined) => Token[];
|
37 |
|
38 |
|
39 |
|
40 | export declare const compile: (str: string, options?: ParseOptions | undefined) => PathFunction;
|
41 |
|
42 |
|
43 |
|
44 | export declare const tokensToFunction: (tokens: Token[]) => PathFunction;
|
45 |
|
46 |
|
47 |
|
48 | export declare const tokensToRegExp: (tokens: Token[], keys?: Key[] | undefined, options?: RegExpOptions | undefined) => RegExp;
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 | export declare const pathToRegexp: (path: import("../global/interfaces").Path, keys: Key[], options: RegExpOptions) => RegExp;
|