Comparing version 2.0.0 to 2.1.1
@@ -44,3 +44,3 @@ | ||
return match.node.cb() | ||
return match.node.cb(match ? match.param : {}) | ||
} | ||
@@ -47,0 +47,0 @@ |
{ | ||
"name": "wayfarer", | ||
"version": "2.0.0", | ||
"version": "2.1.1", | ||
"description": "A simple router built for minimalism and speed", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -38,5 +38,4 @@ # wayfarer | ||
#### .on(path, cb) | ||
Register a new path. Partial paths are supported through the `/:` operator. | ||
Wayfarer uses a trie structure to match routes, so the order in which routes are | ||
registered does not matter. | ||
Register a new path. Wayfarer uses a trie to match routes, so the order in | ||
which routes are registered does not matter. | ||
```js | ||
@@ -47,2 +46,9 @@ router.on('/', () => console.log('do stuff')) | ||
Partial paths are supported through the `/:` operator, and the callback | ||
provides a param object. With a route like `/:user` if you navigated to | ||
`/somename`, you'd get a param object like this: `{ user: 'somename' }`. | ||
```js | ||
router.on('/:user', (param) => console.log('do user stuff', param.user)) | ||
``` | ||
#### .match(path) | ||
@@ -49,0 +55,0 @@ Match a path against the saved paths in the router. If a match is |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6360
74