Skip to content
Myr

Possible fix for #1557, allows routes to be created using literal regexes across V8 contexts. Removes all uses of `instanceof`.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Josh Dague · committed by Josh Dague · parent 158f452 · Browse files · 2 files+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+2 added−2 removed

  • tests:+1 added−1 removed
  • other:+1 added−1 removed

2 files+2 added−2 removed

modified:lib/utils.js+1 added-1 removed
256 unmodified lines
257 * @api private258 */259260exports.pathRegexp = function(path, keys, sensitive, strict) {261 if (path instanceof RegExp) return path;261 if (Object.prototype.toString.call(path) == '[object RegExp]') return path; // see #1557262 if (Array.isArray(path)) path = '(' + path.join('|') + ')';263 path = path264 .concat(strict ? '' : '/?')265 .replace(/\/\(/g, '(?:/')
15 unmodified lines
modified:test/app.param.js+1 added-1 removed