From 9578d07b5ce2f734c57dee95aeff665444113f05 Mon Sep 17 00:00:00 2001 From: Riki Fridrich Date: Sun, 7 May 2023 06:09:39 +0200 Subject: [PATCH] feat: add type definitions --- package.json | 3 ++- types/index.d.ts | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 types/index.d.ts diff --git a/package.json b/package.json index 8fc5e0a..35e4c3c 100644 --- a/package.json +++ b/package.json @@ -52,5 +52,6 @@ }, "dependencies": { "array-reduce-prototypejs-fix": "^1.2.0" - } + }, + "types": "types/index.d.ts" } diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..03f0d20 --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,21 @@ +interface UrlMatchFragmentDebug { + pattern: string, + value: string, + result: boolean +} + +interface UrlMatchPatternDebug { + scheme: UrlMatchFragmentDebug, + host: UrlMatchFragmentDebug, + path: UrlMatchFragmentDebug, + params: UrlMatchFragmentDebug, + fragment: UrlMatchFragmentDebug, +} + +export default class UrlMatch { + constructor(patterns?: string[]); + add(patterns?: string[]): string[]; + remove(patterns?: string[]): string[]; + test(content: string): boolean; + debug(content: string): Record; +}