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

wayfarer

Package Overview
Dependencies
Maintainers
3
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 3.0.3 to 3.1.0

21

index.js

@@ -1,3 +0,3 @@

const routington = require('routington')
const assert = require('assert')
var routington = require('routington')
var assert = require('assert')

@@ -10,6 +10,7 @@ module.exports = wayfarer

dft = dft || ''
const router = routington()
var router = routington()
emit.emit = emit
emit.on = on
emit.match = match

@@ -23,3 +24,3 @@ return emit

assert.equal(typeof cb, 'function')
const node = router.define(path)[0]
var node = router.define(path)[0]
node.cb = cb

@@ -29,9 +30,15 @@ return emit

// match a route
// match and call a route
// str -> null
function emit (path) {
path = path || ''
const match = router.match(path) || router.match(dft)
match.node.cb(path, match ? match.param : {})
var matched = match(path)
if (matched) matched.node.cb(path, matched.param)
}
// match and return route
// str -> obj
function match (path) {
return router.match(path) || router.match(dft)
}
}
{
"name": "wayfarer",
"version": "3.0.3",
"version": "3.1.0",
"description": "Composable trie based router",

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

"mocha": "^1.20.1",
"standard": "^4.0.1",
"tape": "^3.0.3"

@@ -35,0 +36,0 @@ },

@@ -59,2 +59,5 @@ # wayfarer

### router.match(route)
Match and return a route without executing the corresponding callback.
## Why?

@@ -61,0 +64,0 @@ Routers like [react-router](https://github.com/rackt/react-router) are

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