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 2.1.1 to 2.2.0

2

index.js

@@ -44,3 +44,3 @@

return match.node.cb(match ? match.param : {})
return match.node.cb(path, match ? match.param : {})
}

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

{
"name": "wayfarer",
"version": "2.1.1",
"version": "2.2.0",
"description": "A simple router built for minimalism and speed",
"main": "index.js",
"scripts": {
"test": "NODE_ENV=test ./node_modules/mocha/bin/mocha --recursive --harmony-generators -R spec",
"coverage": "./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha --report text --recursive -- -R spec && rm -rf ./coverage/"
"test": "NODE_ENV=test tape test.js | tap-bail | tap-spec",
"test-cov": "NODE_ENV=test istanbul cover test.js"
},

@@ -33,4 +33,7 @@ "repository": {

"mocha": "^1.20.1",
"should": "^4.0.4"
"should": "^4.0.4",
"tap-bail": "0.0.0",
"tap-spec": "^2.1.2",
"tape": "^3.0.3"
}
}

@@ -26,3 +26,3 @@ # wayfarer

router.match('/tobi')
// => '/:user'
// => '/user'
```

@@ -50,5 +50,18 @@

```js
router.on('/:user', (param) => console.log('do user stuff', param.user))
router.on('/:user', (uri, param) => console.log('my name is ', param.user))
```
Nested routers are supported by passing in `.match()` as the callback to
another router.
```js
const main = wayfarer()
const sub = wayfarer()
main.on('/foo', sub.match.bind(sub))
sub.on('/foo/bar'), (uri) => console.log(uri))
main.match('/foo/bar')
// '/foo/bar'
```
#### .match(path)

@@ -64,2 +77,3 @@ Match a path against the saved paths in the router. If a match is

- [hash-match](https://github.com/sethvincent/hash-match) - easy `window.location.hash` matching
- [pathname-match](https://github.com/yoshuawuyts/pathname-match) - strip a url to only match the pathname

@@ -66,0 +80,0 @@ ## License

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