path-to-regexp 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of path-to-regexp might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +6 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -31,6 +31,7 @@ function pathtoRegexp(path, keys, options) {
31
31
  var strict = options.strict;
32
32
  var end = options.end !== false;
33
33
  var flags = options.sensitive ? '' : 'i';
34
+ var lookahead = options.lookahead !== false;
34
35
  var extraOffset = 0;
35
36
  var keysOffset = keys.length;
36
37
  var i = 0;
@@ -123,7 +124,11 @@ function pathtoRegexp(path, keys, options) {
123
124
  }
124
125
 
125
126
  // If the path is non-ending, match until the end or a slash.
126
- path += (end ? '$' : (path[path.length - 1] === '/' ? '' : '(?=\\/|$)'));
127
+ if (end) {
128
+ path += '$';
129
+ } else if (path[path.length - 1] !== '/') {
130
+ path += lookahead ? '(?=\\/|$)' : '(?:\/|$)';
131
+ }
127
132
 
128
133
  return new RegExp(path, flags);
129
134
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "path-to-regexp",
3
3
  "description": "Express style path to RegExp utility",
4
- "version": "0.1.8",
4
+ "version": "0.1.9",
5
5
  "files": [
6
6
  "index.js",
7
7
  "LICENSE"