UI for Zipcoin Blue

index.d.ts 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. declare function pathToRegexp (path: pathToRegexp.Path, options?: pathToRegexp.RegExpOptions & pathToRegexp.ParseOptions): pathToRegexp.PathRegExp;
  2. declare function pathToRegexp (path: pathToRegexp.Path, keys?: pathToRegexp.Key[], options?: pathToRegexp.RegExpOptions & pathToRegexp.ParseOptions): pathToRegexp.PathRegExp;
  3. declare namespace pathToRegexp {
  4. export interface PathRegExp extends RegExp {
  5. // An array to be populated with the keys found in the path.
  6. keys: Key[];
  7. }
  8. export interface RegExpOptions {
  9. /**
  10. * When `true` the route will be case sensitive. (default: `false`)
  11. */
  12. sensitive?: boolean;
  13. /**
  14. * When `false` the trailing slash is optional. (default: `false`)
  15. */
  16. strict?: boolean;
  17. /**
  18. * When `false` the path will match at the beginning. (default: `true`)
  19. */
  20. end?: boolean;
  21. /**
  22. * Sets the final character for non-ending optimistic matches. (default: `/`)
  23. */
  24. delimiter?: string;
  25. }
  26. export interface ParseOptions {
  27. /**
  28. * Set the default delimiter for repeat parameters. (default: `'/'`)
  29. */
  30. delimiter?: string;
  31. }
  32. /**
  33. * Parse an Express-style path into an array of tokens.
  34. */
  35. export function parse (path: string, options?: ParseOptions): Token[];
  36. /**
  37. * Transforming an Express-style path into a valid path.
  38. */
  39. export function compile (path: string, options?: ParseOptions): PathFunction;
  40. /**
  41. * Transform an array of tokens into a path generator function.
  42. */
  43. export function tokensToFunction (tokens: Token[]): PathFunction;
  44. /**
  45. * Transform an array of tokens into a matching regular expression.
  46. */
  47. export function tokensToRegExp (tokens: Token[], options?: RegExpOptions): PathRegExp;
  48. export function tokensToRegExp (tokens: Token[], keys?: Key[], options?: RegExpOptions): PathRegExp;
  49. export interface Key {
  50. name: string | number;
  51. prefix: string;
  52. delimiter: string;
  53. optional: boolean;
  54. repeat: boolean;
  55. pattern: string;
  56. partial: boolean;
  57. asterisk: boolean;
  58. }
  59. interface PathFunctionOptions {
  60. pretty?: boolean;
  61. }
  62. export type Token = string | Key;
  63. export type Path = string | RegExp | Array<string | RegExp>;
  64. export type PathFunction = (data?: Object, options?: PathFunctionOptions) => string;
  65. }
  66. export = pathToRegexp;