@shakerquiz/utilities 0.5.210 → 0.5.211
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/source/functions/key.js +27 -7
package/package.json
CHANGED
package/source/functions/key.js
CHANGED
|
@@ -2,13 +2,33 @@ import { inferMethod } from '../enumerations/method.js'
|
|
|
2
2
|
|
|
3
3
|
import { hydrateRoutePathname } from './hydrate-route-pathname.js'
|
|
4
4
|
|
|
5
|
-
export const tag = Object.freeze(
|
|
6
|
-
|
|
5
|
+
export const tag = Object.freeze(
|
|
6
|
+
/**
|
|
7
|
+
* @template {keyof typeof import('../enumerations/method.js').Method} M
|
|
8
|
+
* @template {keyof typeof import('../enumerations/route.js').Route} R
|
|
9
|
+
*
|
|
10
|
+
* @param {M} m
|
|
11
|
+
* @param {R} r
|
|
12
|
+
* @param {string[]} p
|
|
13
|
+
*/
|
|
14
|
+
(m, r, p) => {
|
|
15
|
+
var method = inferMethod(m)
|
|
7
16
|
|
|
8
|
-
|
|
9
|
-
|
|
17
|
+
if (method === 'Unknown')
|
|
18
|
+
throw TypeError(`Could not infer method of: '${m}'.`)
|
|
10
19
|
|
|
11
|
-
|
|
12
|
-
}
|
|
20
|
+
return method + '/' + hydrateRoutePathname(r, p)
|
|
21
|
+
},
|
|
22
|
+
)
|
|
13
23
|
|
|
14
|
-
export const tagexp = Object.freeze(
|
|
24
|
+
export const tagexp = Object.freeze(
|
|
25
|
+
/**
|
|
26
|
+
* @template {keyof typeof import('../enumerations/method.js').Method} M
|
|
27
|
+
* @template {keyof typeof import('../enumerations/route.js').Route} R
|
|
28
|
+
*
|
|
29
|
+
* @param {M} m
|
|
30
|
+
* @param {R} r
|
|
31
|
+
* @param {string[]} p
|
|
32
|
+
*/
|
|
33
|
+
(m, r, p) => new RegExp(`^${tag(m, r, p)}$`),
|
|
34
|
+
)
|