Socket
Socket
Sign inDemoInstall

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.10.3 to 1.10.4

test/issue-62.test.js

46

index.js

@@ -92,3 +92,3 @@ 'use strict'

if (isRegex) {
i = path.indexOf(')', i) + 1
i = getClosingParenthensePosition(path, i) + 1
break

@@ -279,3 +279,2 @@ } else if (path.charCodeAt(i) !== 45) {

var i = 0
var isStatic = true

@@ -314,3 +313,3 @@ while (true) {

if ((isStatic === true && len > 0) || len === prefixLen) {
if (len === prefixLen) {
path = path.slice(len)

@@ -320,3 +319,3 @@ pathLen = path.length

var node = currentNode.find(path[0], method)
var node = currentNode.find(path, method)
if (node === null) {

@@ -348,4 +347,2 @@ node = currentNode.parametricBrother

isStatic = false
// if exist, save the wildcard child

@@ -515,1 +512,38 @@ if (currentNode.wildcardChild !== null) {

}
/**
* Returns the position of the last closing parenthese of the regexp expression.
*
* @param {String} path
* @param {Number} idx
* @returns {Number}
* @throws {TypeError} when a closing parenthese is missing
* @private
*/
function getClosingParenthensePosition (path, idx) {
// `path.indexOf()` will always return the first position of the closing parenthese,
// but it's inefficient for grouped or wrong regexp expressions.
// see issues #62 and #63 for more info
var parentheses = 1
while (idx < path.length) {
idx++
// ignore skipped chars
if (path[idx] === '\\') {
idx++
continue
}
if (path[idx] === ')') {
parentheses--
} else if (path[idx] === '(') {
parentheses++
}
if (!parentheses) return idx
}
throw new TypeError('Invalid regexp expression in "' + path + '"')
}

12

node.js

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

Node.prototype.find = function (label, method) {
Node.prototype.find = function (path, method) {
for (var i = 0; i < this.numberOfChildren; i++) {
var child = this.children[i]
if (child.numberOfChildren !== 0 || child.handlers[method] !== null) {
if (child.label === label && child.kind === 0) {
return child
}
if (child.kind !== 0) return child
if (
(child.numberOfChildren !== 0 || child.handlers[method] !== null) &&
(child.kind !== 0 || path.slice(0, child.prefix.length) === child.prefix)
) {
return child
}

@@ -75,0 +75,0 @@ }

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

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

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