Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wayfarer

Package Overview
Dependencies
Maintainers
4
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wayfarer - npm Package Compare versions

Comparing version 6.1.5 to 6.2.0

6

package.json
{
"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)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc