path-match.d.ts 848 B

1234567891011121314151617181920212223242526
  1. interface Options {
  2. /**
  3. * A transformer function that will be applied to the regexp generated
  4. * from the provided path and path-to-regexp.
  5. */
  6. regexModifier?: (regex: string) => string;
  7. /**
  8. * When true the function will remove all unnamed parameters
  9. * from the matched parameters.
  10. */
  11. removeUnnamedParams?: boolean;
  12. /**
  13. * When true the regexp won't allow an optional trailing delimiter
  14. * to match.
  15. */
  16. strict?: boolean;
  17. }
  18. /**
  19. * Generates a path matcher function for a given path and options based on
  20. * path-to-regexp. By default the match will be case insesitive, non strict
  21. * and delimited by `/`.
  22. */
  23. export declare function getPathMatch(path: string, options?: Options): <T extends {
  24. [key: string]: any;
  25. }>(pathname?: string | null, params?: any) => false | T;
  26. export {};