UNPKG

ziko

Version:

A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...

30 lines (27 loc) 896 B
// routes_utils.d.ts /** * Checks if a route path is dynamic. * Dynamic segments include: * - Parameters like "[id]" * - Catch-all segments like "[...slug]" * - Optional segments like "[id]+" * * @param path - The route path to check. * @returns `true` if the path is dynamic, otherwise `false`. */ export function is_dynamic(path: string): boolean; /** * Groups routes into static and dynamic categories. * Throws an error if an optional parameter appears anywhere but the end of the path. * * @param routeMap - An object mapping route paths to their handlers/values. * @returns An object with two properties: * - `static`: Routes with no dynamic segments. * - `dynamic`: Routes with dynamic segments. */ export function routes_grouper<T>( routeMap: Record<string, T> ): { static: Record<string, T>; dynamic: Record<string, T>; };