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

wayfarer

Package Overview
Dependencies
Maintainers
5
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.6.3 to 6.6.4

11

index.js

@@ -24,10 +24,11 @@ var assert = require('assert')

// (str, fn) -> obj
function on (route, cb) {
function on (route, fn) {
assert.equal(typeof route, 'string')
assert.equal(typeof cb, 'function')
assert.equal(typeof fn, 'function')
var cb = fn._wayfarer && fn._trie ? fn : proxy
route = route || '/'
cb.route = route
if (cb && cb._wayfarer && cb._trie) {
if (cb._wayfarer && cb._trie) {
_trie.mount(route, cb._trie.trie)

@@ -40,2 +41,6 @@ } else {

return emit
function proxy () {
return fn.apply(this, Array.prototype.slice.call(arguments))
}
}

@@ -42,0 +47,0 @@

{
"name": "wayfarer",
"version": "6.6.3",
"version": "6.6.4",
"description": "Composable trie based router",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -344,2 +344,16 @@ var wayfarer = require('../')

})
t.test('should not mutate callback parameter', function (t) {
t.plan(4)
var r = wayfarer()
var routes = ['/foo', '/bar']
r.on('/foo', callback)
r.on('/bar', callback)
r('/foo')
r('/bar')
function callback () {
t.notEqual(this, callback, 'callback was proxied')
t.equal(this.route, routes.shift(), 'proxy exposes route property')
}
})
})
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