Socket
Socket
Sign inDemoInstall

path-pattern

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-pattern - npm Package Compare versions

Comparing version 0.8.1 to 0.8.2

2

lib/index.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("path-to-regexp")):"function"==typeof define&&define.amd?define(["path-to-regexp"],e):"object"==typeof exports?exports.PathPattern=e(require("path-to-regexp")):t.PathPattern=e(t.PathToRegexp)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=6)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2);e.AbstractPathPattern=function(){function t(t){this.pattern=r.normalizePathPattern(t),this.matchAdvanced=this.matchAdvanced.bind(this),this.match=this.match.bind(this),this.matchExact=this.matchExact.bind(this),this.matchStrict=this.matchStrict.bind(this)}return t.prototype.getPattern=function(){return this.pattern},t}()},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(7),a=n(0),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.matchAdvanced=function(t){var e=this;return void 0===t&&(t={}),function(n){if(!n||null===n.pathname||n.pathname===undefined)return!1;var r=e.getRegExp(t),o=r.exec(n.pathname);if(!o)return!1;var a=o[0],i=o.slice(1);return{path:e.pattern,url:"/"===e.pattern&&""===a?"/":a,isExact:n.pathname===a,params:r.keys.reduce(function(t,e,n){return t[e.name]=i[n],t},{})}}},e.prototype.match=function(t){return this.matchAdvanced()(t)},e.prototype.matchExact=function(t){return this.matchAdvanced({exact:!0})(t)},e.prototype.matchStrict=function(t){return this.matchAdvanced({exact:!0,strict:!0})(t)},e.prototype.compile=function(t){return this.getRegExpCompile()(t)},e.prototype.getRegExp=function(t){this.ensureCacheExist();var n=t.exact+"-"+t.strict,r=e.cache[this.pattern].re[n];if(r===undefined){var a=t.exact,i=void 0!==a&&a,c=t.strict,u=void 0!==c&&c,h={end:i,strict:u},p=o(this.pattern,h);return e.cache[this.pattern].re[n]=p,p}return r},e.prototype.getRegExpCompile=function(){this.ensureCacheExist();var t=e.cache[this.pattern].compile;if(null===t){var n=o.compile(this.pattern);return e.cache[this.pattern].compile=n,n}return t},e.prototype.ensureCacheExist=function(){e.cache[this.pattern]||(e.cache[this.pattern]={re:{},compile:null})},e}(a.AbstractPathPattern);i.cache={},e.PathPattern=i},function(t,e,n){"use strict";function r(t,e){void 0===e&&(e={});for(var n=e.sensitive,r=void 0!==n&&n,o=e.strict,a=void 0===o||o,i=t;"/"===i[0];)i=i.substr(1);return i="/"+i,r||(i=i.toLowerCase()),a||(i=i.length>1&&"/"===i[i.length-1]?i.substr(0,i.length-1):i),i}Object.defineProperty(e,"__esModule",{value:!0}),e.normalizePathPattern=r},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),a=n(1);e.InheritedPathPattern=function(t){function e(e,n){return t.call(this,e.getPattern()+o.normalizePathPattern(n))||this}return r(e,t),e}(a.PathPattern)},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(3),i=n(1);e.RelativePathPattern=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.matchAdvanced=function(t){var e=this;return void 0===t&&(t={}),function(n,r){if(void 0===r&&(r=!1),!1===r)return!1;var o=new i.PathPattern(r.path);return new a.InheritedPathPattern(o,e.pattern).matchAdvanced(t)(n)}},e.prototype.match=function(t,e){return this.matchAdvanced()(t,e)},e.prototype.matchExact=function(t,e){return this.matchAdvanced({exact:!0})(t,e)},e.prototype.matchStrict=function(t,e){return this.matchAdvanced({exact:!0,strict:!0})(t,e)},e.prototype.compile=function(t,e){return new a.InheritedPathPattern(t,this.pattern).compile(e)},e}(o.AbstractPathPattern)},function(t,e,n){"use strict";function r(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return function(e){return t.reduce(function(t,n){return t||n(e)},!1)}}Object.defineProperty(e,"__esModule",{value:!0}),e.matchOneOf=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractPathPattern=n(0).AbstractPathPattern,e.PathPattern=n(1).PathPattern,e.normalizePathPattern=n(2).normalizePathPattern,e.matchOneOf=n(5).matchOneOf,e.InheritedPathPattern=n(3).InheritedPathPattern,e.RelativePathPattern=n(4).RelativePathPattern},function(e,n){e.exports=t}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("path-to-regexp")):"function"==typeof define&&define.amd?define(["path-to-regexp"],e):"object"==typeof exports?exports.PathPattern=e(require("path-to-regexp")):t.PathPattern=e(t.PathToRegexp)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=6)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2);e.AbstractPathPattern=function(){function t(t){this.pattern=r.normalizePathPattern(t),this.matchAdvanced=this.matchAdvanced.bind(this),this.match=this.match.bind(this),this.matchExact=this.matchExact.bind(this),this.matchStrict=this.matchStrict.bind(this)}return t.prototype.getPattern=function(){return this.pattern},t}()},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(7),a=n(0),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.matchAdvanced=function(t){var e=this;return void 0===t&&(t={}),function(n){if(!n||null===n.pathname||n.pathname===undefined)return!1;var r=e.getRegExp(t),o=r.exec(n.pathname);if(!o)return!1;var a=o[0],i=o.slice(1);return{path:e.pattern,url:"/"===e.pattern&&""===a?"/":a,isExact:n.pathname===a,params:r.keys.reduce(function(t,e,n){return t[e.name]=i[n],t},{})}}},e.prototype.match=function(t){return this.matchAdvanced()(t)},e.prototype.matchExact=function(t){return this.matchAdvanced({exact:!0})(t)},e.prototype.matchStrict=function(t){return this.matchAdvanced({exact:!0,strict:!0})(t)},e.prototype.compile=function(t){var e=t?Object.keys(t).reduce(function(e,n){return e[n.toLocaleLowerCase()]=t[n]?t[n]:null,e},{}):{};return this.getRegExpCompile()(e)},e.prototype.getRegExp=function(t){this.ensureCacheExist();var n=t.exact+"-"+t.strict,r=e.cache[this.pattern].re[n];if(r===undefined){var a=t.exact,i=void 0!==a&&a,c=t.strict,u=void 0!==c&&c,h={end:i,strict:u},p=o(this.pattern,h);return e.cache[this.pattern].re[n]=p,p}return r},e.prototype.getRegExpCompile=function(){this.ensureCacheExist();var t=e.cache[this.pattern].compile;if(null===t){var n=o.compile(this.pattern);return e.cache[this.pattern].compile=n,n}return t},e.prototype.ensureCacheExist=function(){e.cache[this.pattern]||(e.cache[this.pattern]={re:{},compile:null})},e}(a.AbstractPathPattern);i.cache={},e.PathPattern=i},function(t,e,n){"use strict";function r(t,e){void 0===e&&(e={});for(var n=e.sensitive,r=void 0!==n&&n,o=e.strict,a=void 0===o||o,i=t;"/"===i[0];)i=i.substr(1);return i="/"+i,r||(i=i.toLowerCase()),a||(i=i.length>1&&"/"===i[i.length-1]?i.substr(0,i.length-1):i),i}Object.defineProperty(e,"__esModule",{value:!0}),e.normalizePathPattern=r},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),a=n(1);e.InheritedPathPattern=function(t){function e(e,n){return t.call(this,e.getPattern()+o.normalizePathPattern(n))||this}return r(e,t),e}(a.PathPattern)},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(3),i=n(1);e.RelativePathPattern=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.matchAdvanced=function(t){var e=this;return void 0===t&&(t={}),function(n,r){if(void 0===r&&(r=!1),!1===r)return!1;var o=new i.PathPattern(r.path);return new a.InheritedPathPattern(o,e.pattern).matchAdvanced(t)(n)}},e.prototype.match=function(t,e){return this.matchAdvanced()(t,e)},e.prototype.matchExact=function(t,e){return this.matchAdvanced({exact:!0})(t,e)},e.prototype.matchStrict=function(t,e){return this.matchAdvanced({exact:!0,strict:!0})(t,e)},e.prototype.compile=function(t,e){return new a.InheritedPathPattern(t,this.pattern).compile(e)},e}(o.AbstractPathPattern)},function(t,e,n){"use strict";function r(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return function(e){return t.reduce(function(t,n){return t||n(e)},!1)}}Object.defineProperty(e,"__esModule",{value:!0}),e.matchOneOf=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractPathPattern=n(0).AbstractPathPattern,e.PathPattern=n(1).PathPattern,e.normalizePathPattern=n(2).normalizePathPattern,e.matchOneOf=n(5).matchOneOf,e.InheritedPathPattern=n(3).InheritedPathPattern,e.RelativePathPattern=n(4).RelativePathPattern},function(e,n){e.exports=t}])});
//# sourceMappingURL=index.js.map
{
"name": "path-pattern",
"version": "0.8.1",
"version": "0.8.2",
"description": "A url matching lib to go with Realytics/react-router-magic",

@@ -5,0 +5,0 @@ "author": "Etienne Dldc <etienne.dldc@outlook.fr>",

@@ -62,3 +62,9 @@ import { Location } from 'history';

compile(params?: Params): string {
return this.getRegExpCompile()(params);
const normalizedParams: { [key: string]: any } = params ? (
Object.keys(params).reduce((acc: { [key: string]: any }, key) => {
acc[key.toLocaleLowerCase()] = ((params as any)[key] ? (params as any)[key] : null);
return acc;
}, {})
) : {};
return this.getRegExpCompile()(normalizedParams);
}

@@ -65,0 +71,0 @@

Sorry, the diff of this file is not supported yet

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