A simple functional router for TypeScript.
npm install --save @typed/router
# or
yarn add @typed/router
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,
})