Comparing version 7.0.0 to 7.0.1
@@ -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') |
{ | ||
"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" | ||
} | ||
} |
23
trie.js
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
32221
4
705
1
+ Addednanoassert@^1.1.0
+ Addednanoassert@1.1.0(transitive)