import { IUrlTreePath } from "../interfaces/iroute"; /** * @since 1.0.0 * @function * @name PatternChunk * @constructor * * @param {string} replace * @param {string} param * @param {number} index * @param {string} source * * @description * Pattern chunk used by pattern */ export declare class PatternChunk { private index; private replace; private source; private param; private regex; constructor(index: number, replace: string, source: string, param?: string); /** * @since 1.0.0 * @function * @name PatternChunk#getRegex * * @description * Get regex from source */ getRegex(): RegExp; /** * @since 1.0.0 * @function * @name PatternChunk#getIndex * * @description * Get index */ getIndex(): number; /** * @since 1.0.0 * @function * @name PatternChunk#getReplaceMatcher * * @description * Get replace matcher */ getReplaceMatcher(): string; /** * @since 1.0.0 * @function * @name PatternChunk#getSource * * @description * Get source */ getSource(): string; /** * @since 1.0.0 * @function * @name PatternChunk#getParam * * @description * Get parameter */ getParam(): string; } /** * @since 1.0.0 * @function * @name Pattern * @constructor * * @param {path} path * @param {regex} replace * @param {chunks} param * * @description * Route match pattern */ export declare class Pattern { private path; private source; private regex; private chunks; constructor(path: string, source: string, regex: RegExp, chunks: Array); /** * @since 1.0.0 * @function * @name Pattern#normalizePath * * @description * Creates path from chunks throws error if no param is correct data type or if it dosen't exist * * @throws Error */ normalizePath(params: Object): string; /** * @since 1.0.0 * @function * @name Pattern#getSource * * @description * Get source pattern */ getSource(): string; /** * @since 1.0.0 * @function * @name Pattern#getChunks * * @description * Get array chunks */ getChunks(): Array; } /** * @since 1.0.0 * @function * @name RouteParser * @constructor * * @param {IUrlTreePath} tree * * @description * RouteParser is responsible for parsing routes */ export declare class RouteParser { path: string; pattern: Pattern; child: RouteParser; parent: RouteParser; /** * @since 1.0.0 * @function * @name RouteParser#toPattern * @param {String} path * @static * * @description * Creates pattern based on path provided * @example * RouteParser.toPattern("--now--not"); */ static toPattern(path: string): Pattern; /** * @since 1.0.0 * @function * @name RouteParser#parse * @param {String} url * @static * * @description * Creates url tree which is used by RouteParser for easier pattern creation * * @example * RouteParser.parse("/canone//shoulddo-it/--now--not/user/"); * */ static parse(url: string): RouteParser; /** * @since 1.0.0 * @function * @name RouteParser * @param {IUrlTreePath} tree * @param {RouteParser} parent * @constructor * * @description * Creates pattern based on path provided * @example * let tree = RouteParser.toUrlTree("/--now--not/bcd"); * let parsedRoute = new RouteParser(tree); */ constructor(tree: IUrlTreePath, parent?: RouteParser); /** * @since 1.0.0 * @function * @name RouteParser#isValid * @param {String} url * @description * Check if url is valid */ isValid(url: string): boolean; /** * @since 1.0.0 * @function * @name RouteParser#createUrl * @param {Object} params * @description * Create url if params are correct type if params are not valid it throws error * @throws Error */ createUrl(params: Object): string; /** * @since 1.0.0 * @function * @name RouteParser#getParams * @param {String} url * @description * Extract params from url * @throws Error */ getParams(url: string): Object; /** * @since 1.0.0 * @function * @name RouteParser#toArray * @description * Convert parser tree to array */ toChunksArray(): Array; /** * @since 1.0.0 * @function * @name RouteParser#getPattern * @description * Get route pattern */ private getPattern(); /** * @since 1.0.0 * @function * @name RouteParser#getHead * @return {RouteParser} * @private * * @description * Return head RouteParser * */ private getHead(); }