UNPKG

@web-atoms/core

Version:
38 lines 1.14 kB
export type ISubstitution = string | { variable: string; }; export type IVariable = { variable: string; convert: (v: string) => any; }; export declare class Variable { readonly variable: string; readonly name?: string; convert: (v: string) => any; readonly catchAll: boolean; readonly optional: boolean; prefix: string; suffix: string; private readonly parseAsNumber; get regex(): string; constructor(variable: string, name?: string); } export default class Route { readonly route: string; readonly order: number; /** * Useful when we want to test urls locally, we can prefix url with `#!` etc * @param url url to encode * @returns string */ static encodeUrl(url: string): string; static create<T>(route: string, queries?: string[], order?: number): Route; readonly regex: RegExp; readonly queries: Map<string, string>; readonly variables: Variable[]; private substitutions; private constructor(); matches(route: string, q?: URLSearchParams): any | null; substitute(vars: any): string; } //# sourceMappingURL=Route.d.ts.map