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.14.1 to 1.15.0

test/case-insesitive.test.js

17

index.js

@@ -35,2 +35,3 @@ 'use strict'

this.caseSensitive = opts.caseSensitive === undefined ? true : opts.caseSensitive
this.ignoreTrailingSlash = opts.ignoreTrailingSlash || false

@@ -100,4 +101,10 @@ this.maxParamLength = opts.maxParamLength || 100

j = i + 1
var staticPart = path.slice(0, i)
if (this.caseSensitive === false) {
staticPart = staticPart.toLowerCase()
}
// add the static part of the route to the tree
this._insert(method, path.slice(0, i), 0, null, null, null, null, version)
this._insert(method, staticPart, 0, null, null, null, null, version)

@@ -154,2 +161,7 @@ // isolate the parameter name

}
if (this.caseSensitive === false) {
path = path.toLowerCase()
}
// static route

@@ -314,2 +326,5 @@ this._insert(method, path, 0, params, handler, store, null, version)

Router.prototype.find = function find (method, path, version) {
if (this.caseSensitive === false) {
path = path.toLowerCase()
}
var maxParamLength = this.maxParamLength

@@ -316,0 +331,0 @@ var currentNode = this.tree

4

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

@@ -30,3 +30,3 @@ "main": "index.js",

"benchmark": "^2.1.4",
"coveralls": "^3.0.1",
"coveralls": "^3.0.2",
"pre-commit": "^1.2.2",

@@ -33,0 +33,0 @@ "request": "^2.87.0",

@@ -57,3 +57,3 @@ # find-my-way

function handler (req, res, params) {
res.send('foo')
res.end('foo')
}

@@ -79,2 +79,15 @@ // maps "/foo/" and "/foo" to `handler`

```
According to [RFC3986](https://tools.ietf.org/html/rfc3986#section-6.2.2.1), find-my-way is case sensitive by default.
You can disable this by setting the `caseSensitive` option to `false`:
in that case all paths will be lowercased before routing, including
parametric and regexp-matched values. You can turn off case sensitivity
with:
```js
const router = require('find-my-way')({
caseSensitive: false
})
```
<a name="on"></a>

@@ -81,0 +94,0 @@ #### on(method, path, [opts], handler, [store])

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