From d6398014d9494577ff8b823b9ebef854989180d7 Mon Sep 17 00:00:00 2001 From: Ilya Shatokhin Date: Sat, 21 Sep 2024 11:01:05 +0300 Subject: [PATCH] Return the regexp used for matching --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 6d1bb29..ff5cba9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -466,7 +466,7 @@ export function match

( return (value: string) => value.split(delimiter).map(decode); }); - return function match(input: string) { + const match = function match(input: string) { const m = regexp.exec(input); if (!m) return false; @@ -483,6 +483,8 @@ export function match

( return { path, params }; }; + match.regexp = regexp; + return match; } export function pathToRegexp(