Sha256: b1c45606e54e6d6cd53b70b5cfc723db0f52ae179db3ac140036e31976bc073f

Contents?: true

Size: 707 Bytes

Versions: 81

Compression:

Stored size: 707 Bytes

Contents

/*
 * Match and params
 */

import { Path } from "./use-location";

export interface DefaultParams {
  [paramName: string]: string;
}
export type Params<T extends DefaultParams = DefaultParams> = T;

export type MatchWithParams<T extends DefaultParams = DefaultParams> = [
  true,
  Params<T>
];
export type NoMatch = [false, null];
export type Match<T extends DefaultParams = DefaultParams> =
  | MatchWithParams<T>
  | NoMatch;

export type MatcherFn = (pattern: Path, path: Path) => Match;

export type PatternToRegexpResult = {
  keys: Array<{ name: string | number }>;
  regexp: RegExp;
};

export default function makeMatcher(
  makeRegexpFn?: (pattern: string) => PatternToRegexpResult
): MatcherFn;

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
isomorfeus-preact-10.5.2 node_modules/wouter-preact/matcher.d.ts