goodrouter
Version:
a good router
13 lines (12 loc) • 864 B
TypeScript
/**
* Take a route template and chops is in pieces! The first piece is a literal part of
* the template. Then the name of a placeholder. Then a literal parts of the template again.
* The first and the last elements are always literal strings taken from the template,
* therefore the number of elements in the resulting iterable is always uneven!
*
* @param routeTemplate template to chop up
* @param parameterPlaceholderRE regular expression to use when searching for parameter placeholders
* @returns Iterable of strings, always an uneven number of elements.
*/
export declare function parseTemplateParts(routeTemplate: string, parameterPlaceholderRE: RegExp): Generator<string, void, unknown>;
export declare function parseTemplatePairs(routeTemplate: string, parameterPlaceholderRE: RegExp): Generator<readonly [string, string | null], void, unknown>;