@shakerquiz/utilities 0.4.83 → 0.4.84

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@shakerquiz/utilities",
4
- "version": "0.4.83",
4
+ "version": "0.4.84",
5
5
  "author": "yurkimus <yurkimus@gmail.com>",
6
6
  "license": "ISC",
7
7
  "scripts": {
@@ -396,3 +396,19 @@ export var RouteSearchParams = /** @type {const} */ ({
396
396
  Mailings: [],
397
397
  Mailing: [],
398
398
  })
399
+
400
+ /**
401
+ * @template {Routes} R
402
+ *
403
+ * @param {R} route
404
+ * @param {typeof RoutePathParams[R]} parameters
405
+ *
406
+ * @returns {string}
407
+ */
408
+ export var hydrateRoutePathname = (route, ...parameters) =>
409
+ parameters
410
+ .map((param, index) => [RoutePathParams[route][index], param])
411
+ .reduce(
412
+ (pathname, [param, value]) => pathname.replace(param, value),
413
+ RoutePathname[route],
414
+ )