UNPKG

@chubbyts/chubbyts-framework

Version:

A minimal, highly performant middleware PSR-15 inspired function based microframework built with as little complexity as possible, aimed primarily at those developers who want to understand all the vendors they use.

13 lines (12 loc) 504 B
/** * ```ts * import type { Route } from '@chubbyts/chubbyts-framework/dist/router/route'; * import type { RoutesByName } from '@chubbyts/chubbyts-framework/dist/router/routes-by-name'; * import { createRoutesByName } from '@chubbyts/chubbyts-framework/dist/router/routes-by-name'; * * const routes: Array<Route> = []; * * const routesByName: RoutesByName = createRoutesByName(routes); * ``` */ export const createRoutesByName = (routes) => new Map(routes.map((route) => [route.name, route]));