Skip to content

TylorS/typed-router

Repository files navigation

@typed/router

A simple functional router for TypeScript.

Get It

npm install --save @typed/router
# or
yarn add @typed/router

API

matchRoute<A>(url: Route, routes: Routes<A>, parameters: Record<string, any> = {}): Match<A>

Matches a url against a series of routes. Routes can be nested as needed.
Additional parameters can be passed in to be used with matched callbacks.

Example:

import { matchRoute } from '@typed/router'

const { path, value } = matchRoute('/home/foo', {
  '/bar': () => 123,
  '/home/foo': () => 456,
})

About

Well-typed and functional router

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages