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

find-my-way

Package Overview
Dependencies
Maintainers
1
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 0.2.1 to 0.2.2

12

index.js

@@ -198,3 +198,7 @@ 'use strict'

while (i < pathLen && path[i] !== '/') i++
params[pindex++] = decodeURIComponent(path.slice(0, i))
try {
params[pindex++] = decodeURIComponent(path.slice(0, i))
} catch (e) {
return null
}
path = path.slice(i)

@@ -207,3 +211,7 @@ continue

if (node) {
params[pindex] = decodeURIComponent(path)
try {
params[pindex] = decodeURIComponent(path)
} catch (e) {
return null
}
currentNode = node

@@ -210,0 +218,0 @@ path = ''

6

package.json
{
"name": "find-my-way",
"version": "0.2.1",
"version": "0.2.2",
"description": "Crazy fast http radix based router",

@@ -8,3 +8,4 @@ "main": "index.js",

"bench": "node bench.js",
"test": "standard && tap test/*.test.js"
"test": "standard && tap test/*.test.js",
"coveralls": "tap test/*.test.js --cov --coverage-report=text-lcov | coveralls"
},

@@ -30,2 +31,3 @@ "repository": {

"benchmark": "^2.1.4",
"coveralls": "^2.13.1",
"request": "^2.81.0",

@@ -32,0 +34,0 @@ "standard": "^10.0.2",

# find-my-way
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) [![Build Status](https://travis-ci.org/delvedor/find-my-way.svg?branch=master)](https://travis-ci.org/delvedor/find-my-way)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) [![Build Status](https://travis-ci.org/delvedor/find-my-way.svg?branch=master)](https://travis-ci.org/delvedor/find-my-way) [![Coverage Status](https://coveralls.io/repos/github/delvedor/find-my-way/badge.svg?branch=master)](https://coveralls.io/github/delvedor/find-my-way?branch=master)

@@ -5,0 +5,0 @@ A crazy fast HTTP router, internally uses an highly performant [Radix Tree](https://en.wikipedia.com/wiki/Radix_tree) (aka compact [Prefix Tree](https://en.wikipedia.com/wiki/Trie)), supports route params, wildcards, and it's framework independent.

@@ -40,16 +40,2 @@ 'use strict'

test('async handler', t => {
t.plan(1)
const findMyWay = FindMyWay({
async: true
})
findMyWay.on('GET', '/test', (req, res, params) => {
t.ok('inside async handler')
})
findMyWay.lookup({ method: 'GET', url: '/test' }, null)
})
test('parametric route', t => {

@@ -198,3 +184,6 @@ t.plan(1)

findMyWay.lookup({ method: 'GET', url: '/test/hello' }, null)
findMyWay.lookup(
{ method: 'GET', url: '/test/hello' },
null
)
})

@@ -209,3 +198,6 @@

t.deepEqual(findMyWay.find('GET', '/test'), { handler: fn, params: {}, store: null })
t.deepEqual(
findMyWay.find('GET', '/test'),
{ handler: fn, params: {}, store: null }
)
})

@@ -220,3 +212,6 @@

t.deepEqual(findMyWay.find('GET', '/test/hello'), { handler: fn, params: { id: 'hello' }, store: null })
t.deepEqual(
findMyWay.find('GET', '/test/hello'),
{ handler: fn, params: { id: 'hello' }, store: null }
)
})

@@ -228,4 +223,6 @@

// t.deepEqual(findMyWay.find('GET', '/test'), { handler: null, params: [], store: null })
t.deepEqual(findMyWay.find('GET', '/test'), null)
t.deepEqual(
findMyWay.find('GET', '/test'),
null
)
})

@@ -240,3 +237,6 @@

t.deepEqual(findMyWay.find('GET', '/test/he%2Fllo'), { handler: fn, params: { id: 'he/llo' }, store: null })
t.deepEqual(
findMyWay.find('GET', '/test/he%2Fllo'),
{ handler: fn, params: { id: 'he/llo' }, store: null }
)
})

@@ -251,3 +251,45 @@

t.deepEqual(findMyWay.find('GET', '/test/he%2Fllo'), { handler: fn, params: { '*': 'he/llo' }, store: null })
t.deepEqual(
findMyWay.find('GET', '/test/he%2Fllo'),
{ handler: fn, params: { '*': 'he/llo' }, store: null }
)
})
test('safe decodeURIComponent', t => {
t.plan(1)
const findMyWay = FindMyWay()
const fn = () => {}
findMyWay.on('GET', '/test/:id', fn)
t.deepEqual(
findMyWay.find('GET', '/test/hel%"Flo'),
null
)
})
test('safe decodeURIComponent - nested route', t => {
t.plan(1)
const findMyWay = FindMyWay()
const fn = () => {}
findMyWay.on('GET', '/test/hello/world/:id/blah', fn)
t.deepEqual(
findMyWay.find('GET', '/test/hello/world/hel%"Flo/blah'),
null
)
})
test('safe decodeURIComponent - wildcard', t => {
t.plan(1)
const findMyWay = FindMyWay()
const fn = () => {}
findMyWay.on('GET', '/test/*', fn)
t.deepEqual(
findMyWay.find('GET', '/test/hel%"Flo'),
null
)
})

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