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

find-my-way

Package Overview
Dependencies
Maintainers
2
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-my-way - npm Package Compare versions

Comparing version 1.6.0 to 1.6.1

test/issue-28.test.js

24

index.js

@@ -206,16 +206,16 @@ 'use strict'

var handle = currentNode.getHandler(method)
if (!handle) return null
if (handle) {
var paramNames = handle.params
var paramsObj = {}
var paramNames = handle.params
var paramsObj = {}
for (i = 0; i < paramNames.length; i++) {
paramsObj[paramNames[i]] = params[i]
}
for (i = 0; i < paramNames.length; i++) {
paramsObj[paramNames[i]] = params[i]
return {
handler: handle.handler,
params: paramsObj,
store: handle.store
}
}
return {
handler: handle.handler,
params: paramsObj,
store: handle.store
}
}

@@ -232,3 +232,3 @@

node = currentNode.find(path[0])
node = currentNode.find(path[0], method)
if (!node) return null

@@ -235,0 +235,0 @@ kind = node.kind

@@ -45,6 +45,8 @@ 'use strict'

Node.prototype.find = function (label) {
// Check in two different places the numberOfChildren and the map object
// gives us around ~5% more speed
Node.prototype.find = function (label, method) {
for (var i = 0; i < this.numberOfChildren; i++) {
var child = this.children[i]
if (child.map || child.children.length) {
if (child.numberOfChildren !== 0) {
if (child.label === label && child.kind === 0) {

@@ -57,2 +59,11 @@ return child

}
if (child.map && child.map[method]) {
if (child.label === label && child.kind === 0) {
return child
}
if (child.kind > 0) {
return child
}
}
}

@@ -59,0 +70,0 @@ return null

{
"name": "find-my-way",
"version": "1.6.0",
"version": "1.6.1",
"description": "Crazy fast http radix based router",

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

@@ -64,10 +64,10 @@ 'use strict'

findMyWay.lookup({ method: 'GET', url: '/a/' }, null)
findMyWay.lookup({ method: 'GET', url: '/a//' }, null)
})
test('Should be 404 / 4', t => {
test('Should get an empty parameter', t => {
t.plan(1)
const findMyWay = FindMyWay({
defaultRoute: (req, res) => {
t.pass('Everything good')
t.fail('We should not be here')
}

@@ -77,6 +77,6 @@ })

findMyWay.on('GET', '/a/:param', (req, res, params) => {
t.fail('We should not be here')
t.equal(params.param, '')
})
findMyWay.lookup({ method: 'GET', url: '/a//' }, null)
findMyWay.lookup({ method: 'GET', url: '/a/' }, null)
})
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