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.3.2 to 1.4.0

9

node.js

@@ -22,2 +22,11 @@ 'use strict'

Node.prototype.add = function (node) {
if (node.kind === 0) {
for (var i = 0; i < this.numberOfChildren; i++) {
if (this.children[i].kind > 0) {
this.children.splice(i, 0, node)
this.numberOfChildren++
return
}
}
}
this.children.push(node)

@@ -24,0 +33,0 @@ this.numberOfChildren++

2

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

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

# 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)
[![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) [![NPM downloads](https://img.shields.io/npm/dm/find-my-way.svg?style=flat)](https://www.npmjs.com/package/find-my-way)
A crazy fast HTTP router, internally uses an highly performant [Radix Tree](https://en.wikipedia.org/wiki/Radix_tree) (aka compact [Prefix Tree](https://en.wikipedia.org/wiki/Trie)), supports route params, wildcards, and it's framework independent.
It is inspired by the [echo](https://github.com/labstack/echo) router, some parts have been extracted from [trekjs](https://github.com/trekjs) router.
A crazy fast HTTP router, internally uses an highly performant [Radix Tree](https://en.wikipedia.org/wiki/Radix_tree) (aka compact [Prefix Tree](https://en.wikipedia.org/wiki/Trie)), supports route params, wildcards, and it's framework independent.
If you want to see a benchmark comparison with the most commonly used routers, see [here](https://github.com/delvedor/router-benchmark).
Do you need a real-world example that uses this router? Check out [Fastify](https://github.com/fastify/fastify).
<a name="install"></a>

@@ -63,3 +65,4 @@ ## Install

```
If you want to register a **parametric** path, just use the *colon* before the parameter name, if you need a **wildcard** use the *star*.
If you want to register a **parametric** path, just use the *colon* before the parameter name, if you need a **wildcard** use the *star*.
*Remember that static routes are always inserted before parametric and wildcard.*
```js

@@ -130,3 +133,4 @@ // parametric

This project is kindly sponsored by [LetzDoIt](http://www.letzdoitapp.com/).
This project is kindly sponsored by [LetzDoIt](http://www.letzdoitapp.com/).
It is inspired by the [echo](https://github.com/labstack/echo) router, some parts have been extracted from [trekjs](https://github.com/trekjs) router.

@@ -138,4 +142,2 @@ <a name="license"></a>

*The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.*
Copyright © 2017 Tomas Della Vedova

@@ -329,1 +329,79 @@ 'use strict'

})
test('static routes should be inserted before parametric / 1', t => {
t.plan(1)
const findMyWay = FindMyWay()
findMyWay.on('GET', '/test/hello', () => {
t.pass('inside correct handler')
})
findMyWay.on('GET', '/test/:id', () => {
t.fail('wrong handler')
})
findMyWay.lookup({ method: 'GET', url: '/test/hello' }, null)
})
test('static routes should be inserted before parametric / 2', t => {
t.plan(1)
const findMyWay = FindMyWay()
findMyWay.on('GET', '/test/:id', () => {
t.fail('wrong handler')
})
findMyWay.on('GET', '/test/hello', () => {
t.pass('inside correct handler')
})
findMyWay.lookup({ method: 'GET', url: '/test/hello' }, null)
})
test('static routes should be inserted before parametric / 3', t => {
t.plan(2)
const findMyWay = FindMyWay()
findMyWay.on('GET', '/:id', () => {
t.fail('wrong handler')
})
findMyWay.on('GET', '/test', () => {
t.ok('inside correct handler')
})
findMyWay.on('GET', '/test/:id', () => {
t.fail('wrong handler')
})
findMyWay.on('GET', '/test/hello', () => {
t.ok('inside correct handler')
})
findMyWay.lookup({ method: 'GET', url: '/test' }, null)
findMyWay.lookup({ method: 'GET', url: '/test/hello' }, null)
})
test('static routes should be inserted before parametric / 4', t => {
t.plan(2)
const findMyWay = FindMyWay()
findMyWay.on('GET', '/:id', () => {
t.ok('inside correct handler')
})
findMyWay.on('GET', '/test', () => {
t.fail('wrong handler')
})
findMyWay.on('GET', '/test/:id', () => {
t.ok('inside correct handler')
})
findMyWay.on('GET', '/test/hello', () => {
t.fail('wrong handler')
})
findMyWay.lookup({ method: 'GET', url: '/test/id' }, null)
findMyWay.lookup({ method: 'GET', url: '/id' }, 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