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.0.3 to 6.1.0

12

index.js
const assert = require('assert')
const sliced = require('sliced')
const trie = require('./trie')

@@ -43,8 +44,15 @@

assert.notEqual(route, undefined, "'route' must be defined")
const args = sliced(arguments)
const node = _trie.match(route)
if (node && node.cb) return node.cb(node.params)
if (node && node.cb) {
args[0] = node.params
return node.cb.apply(null, args)
}
const dft = _trie.match(_default)
if (dft && dft.cb) return dft.cb(dft.params)
if (dft && dft.cb) {
args[0] = dft.params
return dft.cb.apply(null, args)
}

@@ -51,0 +59,0 @@ throw new Error("route '" + route + "' did not match")

3

package.json
{
"name": "wayfarer",
"version": "6.0.3",
"version": "6.1.0",
"description": "Composable trie based router",

@@ -28,2 +28,3 @@ "main": "index.js",

"dependencies": {
"sliced": "^1.0.1",
"xtend": "^4.0.1"

@@ -30,0 +31,0 @@ },

@@ -57,3 +57,3 @@ # wayfarer [![stability][0]][1]

### router.on(route, cb(params))
### router.on(route, cb(params, [arg1, ...]))
Register a new route. The order in which routes are registered does not matter.

@@ -63,5 +63,6 @@ Routes can register multiple callbacks. The callback can return values when

### val = router(route)
### val = router(route, [arg1, ...])
Match a route and execute the corresponding callback. Alias: `router.emit()`.
Returns a values from the matched route (e.g. useful for streams).
Returns a values from the matched route (e.g. useful for streams). Any
additional values will be passed to the matched route.

@@ -68,0 +69,0 @@ ## Internals

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