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

path-to-regexp

Package Overview
Dependencies
Maintainers
33
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-to-regexp - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

.npmignore

10

History.md

@@ -0,1 +1,11 @@

1.2.0 / 2015-05-20
==================
* Add support for matching an asterisk (`*`) as an unnamed match everything group (`(.*)`)
1.1.1 / 2015-05-11
==================
* Expose methods for working with path tokens
1.1.0 / 2015-05-09

@@ -2,0 +12,0 @@ ==================

11

index.js

@@ -24,5 +24,6 @@ var isarray = require('isarray')

//
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?"]
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined]
'([\\/.])?(?:\\:(\\w+)(?:\\(((?:\\\\.|[^)])*)\\))?|\\(((?:\\\\.|[^)])*)\\))([+*?])?'
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
// "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^()])+)\\))?|\\(((?:\\\\.|[^()])+)\\))([+*?])?|(\\*))'
].join('|'), 'g')

@@ -67,2 +68,3 @@

var suffix = res[6]
var asterisk = res[7]

@@ -72,2 +74,3 @@ var repeat = suffix === '+' || suffix === '*'

var delimiter = prefix || '/'
var pattern = capture || group || (asterisk ? '.*' : '[^' + delimiter + ']+?')

@@ -80,3 +83,3 @@ tokens.push({

repeat: repeat,
pattern: escapeGroup(capture || group || '[^' + delimiter + ']+?')
pattern: escapeGroup(pattern)
})

@@ -83,0 +86,0 @@ }

{
"name": "path-to-regexp",
"description": "Express style path to RegExp utility",
"version": "1.1.1",
"version": "1.2.0",
"files": [

@@ -6,0 +6,0 @@ "index.js",

@@ -132,2 +132,14 @@ # Path-to-RegExp

#### Asterisk
An asterisk can be used for matching everything. It is equivalent to an unnamed matching group of `(.*)`.
```js
var re = pathToRegexp('/foo/*', keys)
// keys = [{ name: '0', ... }]
re.exec('/foo/bar/baz')
//=> ['/foo/bar/baz', 'bar/baz']
```
### Parse

@@ -134,0 +146,0 @@

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