Comparing version 6.1.5 to 6.2.0
{ | ||
"name": "wayfarer", | ||
"version": "6.1.5", | ||
"version": "6.2.0", | ||
"description": "Composable trie based router", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "standard && NODE_ENV=test node test", | ||
"test-cov": "NODE_ENV=test istanbul cover test.js" | ||
"test": "standard && NODE_ENV=test tape test/*", | ||
"test-cov": "NODE_ENV=test istanbul cover test/*" | ||
}, | ||
@@ -10,0 +10,0 @@ "repository": "yoshuawuyts/wayfarer", |
@@ -57,2 +57,25 @@ # wayfarer [![stability][0]][1] | ||
## Walk | ||
Sometimes it's necessary to walk the `trie` to apply transformations. | ||
```js | ||
const walk = require('wayfarer/walk') | ||
const wayfarer = require('wayfarer') | ||
const router = wayfarer() | ||
router.on('/multiply', (x, y) => x * y) | ||
router.on('/divide', (x, y) => x / y) | ||
walk(router, (route, cb) => { | ||
const y = 2 | ||
return function (params, x) { | ||
return cb(x, y) | ||
} | ||
}) | ||
router('/multiply', 4) | ||
// => 8 | ||
router('/divide', 8) | ||
// => 4 | ||
``` | ||
## API | ||
@@ -59,0 +82,0 @@ ### router = wayfarer(default) |
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
13466
150