Socket
Socket
Sign inDemoInstall

wayfarer

Package Overview
Dependencies
Maintainers
30
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 7.0.0 to 7.0.1

1

get-all-routes.js

@@ -0,1 +1,2 @@

/* eslint-disable node/no-deprecated-api */
var assert = require('assert')

@@ -2,0 +3,0 @@

@@ -0,1 +1,2 @@

/* eslint-disable node/no-deprecated-api */
var assert = require('assert')

@@ -2,0 +3,0 @@ var trie = require('./trie')

21

package.json
{
"name": "wayfarer",
"version": "7.0.0",
"version": "7.0.1",
"description": "Composable trie based router",
"main": "index.js",
"scripts": {
"test": "standard && NODE_ENV=test tape test/*",
"test-cov": "NODE_ENV=test istanbul cover tape -- test/*"
"test": "standard && npm run test-no-cov",
"test-cov": "NODE_ENV=test nyc tape test/*",
"test-no-cov": "NODE_ENV=test tape test/*"
},
"repository": "yoshuawuyts/wayfarer",
"repository": "choojs/wayfarer",
"keywords": [

@@ -27,10 +28,14 @@ "router",

"license": "MIT",
"dependencies": {},
"browser": {
"assert": "nanoassert"
},
"dependencies": {
"nanoassert": "^1.1.0"
},
"devDependencies": {
"istanbul": "^0.4.5",
"mocha": "^3.1.2",
"noop2": "^2.0.0",
"standard": "^8.4.0",
"nyc": "^15.0.0",
"standard": "^14.3.1",
"tape": "^4.6.2"
}
}

@@ -0,1 +1,2 @@

/* eslint-disable node/no-deprecated-api */
var assert = require('assert')

@@ -21,3 +22,3 @@

function createNode (index, trie) {
var thisRoute = (routes.hasOwnProperty(index) && routes[index])
var thisRoute = (has(routes, index) && routes[index])
if (thisRoute === false) return trie

@@ -28,7 +29,7 @@

// if node is a name match, set name and append to ':' node
if (!trie.nodes.hasOwnProperty('$$')) {
if (!has(trie.nodes, '$$')) {
node = { nodes: {} }
trie.nodes['$$'] = node
trie.nodes.$$ = node
} else {
node = trie.nodes['$$']
node = trie.nodes.$$
}

@@ -41,3 +42,3 @@

trie.name = thisRoute.replace(/^:|^\*/, '')
} else if (!trie.nodes.hasOwnProperty(thisRoute)) {
} else if (!has(trie.nodes, thisRoute)) {
node = { nodes: {} }

@@ -71,3 +72,3 @@ trie.nodes[thisRoute] = node

if (trie.nodes.hasOwnProperty(thisRoute)) {
if (has(trie.nodes, thisRoute)) {
// match regular routes first

@@ -82,7 +83,7 @@ return search(index + 1, trie.nodes[thisRoute])

}
return search(index + 1, trie.nodes['$$'])
return search(index + 1, trie.nodes.$$)
} else if (trie.wildcard) {
// match wildcards
try {
params['wildcard'] = decodeURIComponent(routes.slice(index).join('/'))
params.wildcard = decodeURIComponent(routes.slice(index).join('/'))
} catch (e) {

@@ -92,3 +93,3 @@ return search(index, undefined)

// return early, or else search may keep recursing through the wildcard
return trie.nodes['$$']
return trie.nodes.$$
} else {

@@ -141,1 +142,5 @@ // no matches found

}
function has (object, property) {
return Object.prototype.hasOwnProperty.call(object, property)
}

@@ -0,1 +1,2 @@

/* eslint-disable node/no-deprecated-api */
var assert = require('assert')

@@ -2,0 +3,0 @@

Sorry, the diff of this file is not supported yet

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