How to use the chemin.Chemin.parse function in chemin

To help you get started, we’ve selected a few chemin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github etienne-dldc / tumau / packages / tumau-router / src / Route.ts View on Github external
function createRoute(
  options: RouteOptions,
  middleware: null | Middleware | Array,
  children: Routes = []
): Route {
  const { exact = true, method = null, pattern = null } = options;
  const patternResolved = typeof pattern === 'string' ? Chemin.parse(pattern) : pattern;
  return {
    [ROUTE_TOKEN]: true,
    pattern: patternResolved,
    exact,
    middleware: resolveMiddleware(middleware),
    method,
    children,
  };
}

chemin

A type-safe pattern builder & route matching library written in TypeScript

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis