UNPKG

@furystack/shades

Version:

A lightweight UI framework for FuryStack with JSX support

9 lines 517 B
import { compile } from 'path-to-regexp'; const stringifyObjectValues = (params) => Object.fromEntries(Object.entries(params).map(([key, value]) => [key, value?.toString()])); /** * Resolves a `path-to-regexp` URL pattern (e.g. `/users/:id`) by substituting * `params` and string-coercing each value. Used internally by routing * helpers to build hrefs from typed param objects. */ export const compileRoute = (url, params) => compile(url)(stringifyObjectValues(params)); //# sourceMappingURL=compile-route.js.map