Socket
Socket
Sign inDemoInstall

redux-first-routing

Package Overview
Dependencies
13
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.2 to 0.3.0

171

dist/redux-first-routing.js

@@ -24,2 +24,4 @@ (function (global, factory) {

'use strict';
/**

@@ -45,2 +47,4 @@ * Similar to invariant but only logs a warning if the condition is not met.

'use strict';
/**

@@ -81,15 +85,17 @@ * Use invariant() to assert state which your program assumes to be true.

var isAbsolute = function isAbsolute(pathname) {
function isAbsolute(pathname) {
return pathname.charAt(0) === '/';
};
}
// About 1.5x faster than the two-arg version of Array#splice()
var spliceOne = function spliceOne(list, index) {
function spliceOne(list, index) {
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
list[i] = list[k];
}list.pop();
};
}
list.pop();
}
// This implementation is based heavily on node's url.parse
var resolvePathname = function resolvePathname(to) {
function resolvePathname(to) {
var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';

@@ -147,14 +153,13 @@

return result;
};
}
var index = resolvePathname;
var index$2 = createCommonjsModule(function (module, exports) {
'use strict';
exports.__esModule = true;
var resolvePathname$2 = Object.freeze({
default: resolvePathname
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var valueEqual = function valueEqual(a, b) {
function valueEqual(a, b) {
if (a === b) return true;

@@ -164,5 +169,7 @@

if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every(function (item, index) {
return valueEqual(item, b[index]);
});
if (Array.isArray(a)) {
return Array.isArray(b) && a.length === b.length && a.every(function (item, index) {
return valueEqual(item, b[index]);
});
}

@@ -191,5 +198,8 @@ var aType = typeof a === 'undefined' ? 'undefined' : _typeof(a);

return false;
};
}
exports.default = valueEqual;
var valueEqual$2 = Object.freeze({
default: valueEqual
});

@@ -261,2 +271,8 @@

unwrapExports(PathUtils);
var _resolvePathname = ( resolvePathname$2 && resolvePathname ) || resolvePathname$2;
var _valueEqual = ( valueEqual$2 && valueEqual ) || valueEqual$2;
var LocationUtils = createCommonjsModule(function (module, exports) {

@@ -272,7 +288,7 @@ 'use strict';

var _resolvePathname2 = _interopRequireDefault(index);
var _resolvePathname2 = _interopRequireDefault(_resolvePathname);
var _valueEqual2 = _interopRequireDefault(index$2);
var _valueEqual2 = _interopRequireDefault(_valueEqual);

@@ -344,2 +360,4 @@

unwrapExports(LocationUtils);
var createTransitionManager_1 = createCommonjsModule(function (module, exports) {

@@ -433,2 +451,4 @@ 'use strict';

unwrapExports(createTransitionManager_1);
var DOMUtils = createCommonjsModule(function (module, exports) {

@@ -492,2 +512,4 @@ 'use strict';

unwrapExports(DOMUtils);
var createBrowserHistory_1 = createCommonjsModule(function (module, exports) {

@@ -805,2 +827,4 @@ 'use strict';

'use strict';
/*

@@ -812,2 +836,3 @@ object-assign

'use strict';
/* eslint-disable no-unused-vars */

@@ -870,3 +895,3 @@ var getOwnPropertySymbols = Object.getOwnPropertySymbols;

var index$8 = shouldUseNative() ? Object.assign : function (target, source) {
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
var from;

@@ -898,2 +923,102 @@ var to = toObject(target);

'use strict';
var token = '%[a-f0-9]{2}';
var singleMatcher = new RegExp(token, 'gi');
var multiMatcher = new RegExp('(' + token + ')+', 'gi');
function decodeComponents(components, split) {
try {
// Try to decode the entire string first
return decodeURIComponent(components.join(''));
} catch (err) {
// Do nothing
}
if (components.length === 1) {
return components;
}
split = split || 1;
// Split the array in 2 parts
var left = components.slice(0, split);
var right = components.slice(split);
return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
}
function decode(input) {
try {
return decodeURIComponent(input);
} catch (err) {
var tokens = input.match(singleMatcher);
for (var i = 1; i < tokens.length; i++) {
input = decodeComponents(tokens, i).join('');
tokens = input.match(singleMatcher);
}
return input;
}
}
function customDecodeURIComponent(input) {
// Keep track of all the replacements and prefill the map with the `BOM`
var replaceMap = {
'%FE%FF': '\uFFFD\uFFFD',
'%FF%FE': '\uFFFD\uFFFD'
};
var match = multiMatcher.exec(input);
while (match) {
try {
// Decode as big chunks as possible
replaceMap[match[0]] = decodeURIComponent(match[0]);
} catch (err) {
var result = decode(match[0]);
if (result !== match[0]) {
replaceMap[match[0]] = result;
}
}
match = multiMatcher.exec(input);
}
// Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
replaceMap['%C2'] = '\uFFFD';
var entries = Object.keys(replaceMap);
for (var i = 0; i < entries.length; i++) {
// Replace all decoded components
var key = entries[i];
input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
}
return input;
}
var decodeUriComponent = function (encodedURI) {
if (typeof encodedURI !== 'string') {
throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
}
try {
encodedURI = encodedURI.replace(/\+/g, ' ');
// Try the built in decoder first
return decodeURIComponent(encodedURI);
} catch (err) {
// Fallback to a more advanced decoder
return customDecodeURIComponent(encodedURI);
}
};
'use strict';
function parserForArrayFormat(opts) {

@@ -964,3 +1089,3 @@ var result;

var parse = function (str, opts) {
opts = index$8({arrayFormat: 'none'}, opts);
opts = objectAssign({arrayFormat: 'none'}, opts);

@@ -992,5 +1117,5 @@ var formatter = parserForArrayFormat(opts);

// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
val = val === undefined ? null : decodeURIComponent(val);
val = val === undefined ? null : decodeUriComponent(val);
formatter(decodeURIComponent(key), val, ret);
formatter(decodeUriComponent(key), val, ret);
});

@@ -997,0 +1122,0 @@

2

dist/redux-first-routing.min.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.ReduxFirstRouting={})}(this,function(e){"use strict";function t(e,t){return t={exports:{}},e(t,t.exports),t.exports}function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(e){var t;switch(e.arrayFormat){case"index":return function(e,n,r){t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return function(e,n,r){t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};default:return function(e,t,n){void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}function o(e){return Array.isArray(e)?e.sort():"object"==typeof e?o(Object.keys(e)).sort(function(e,t){return Number(e)-Number(t)}).map(function(t){return e[t]}):e}function a(e,t){t.dispatch(S({pathname:e.location.pathname,search:e.location.search,hash:e.location.hash})),e.listen(function(e){t.dispatch(S({pathname:e.pathname,search:e.search,hash:e.hash}))})}var i=function(){},u=function(e,t,n,r,o,a,i,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,a,i,u],f=0;(s=new Error(t.replace(/%s/g,function(){return c[f++]}))).name="Invariant Violation"}throw s.framesToPop=1,s}},s=function(e){return"/"===e.charAt(0)},c=function(e,t){for(var n=t,r=n+1,o=e.length;r<o;n+=1,r+=1)e[n]=e[r];e.pop()},f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=e&&e.split("/")||[],r=t&&t.split("/")||[],o=e&&s(e),a=t&&s(t),i=o||a;if(e&&s(e)?r=n:n.length&&(r.pop(),r=r.concat(n)),!r.length)return"/";var u=void 0;if(r.length){var f=r[r.length-1];u="."===f||".."===f||""===f}else u=!1;for(var h=0,l=r.length;l>=0;l--){var d=r[l];"."===d?c(r,l):".."===d?(c(r,l),h++):h&&(c(r,l),h--)}if(!i)for(;h--;h)r.unshift("..");!i||""===r[0]||r[0]&&s(r[0])||r.unshift("");var p=r.join("/");return u&&"/"!==p.substr(-1)&&(p+="/"),p},h=t(function(e,t){t.__esModule=!0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function e(t,r){if(t===r)return!0;if(null==t||null==r)return!1;if(Array.isArray(t))return Array.isArray(r)&&t.length===r.length&&t.every(function(t,n){return e(t,r[n])});var o=void 0===t?"undefined":n(t);if(o!==(void 0===r?"undefined":n(r)))return!1;if("object"===o){var a=t.valueOf(),i=r.valueOf();if(a!==t||i!==r)return e(a,i);var u=Object.keys(t),s=Object.keys(r);return u.length===s.length&&u.every(function(n){return e(t[n],r[n])})}return!1};t.default=r}),l=t(function(e,t){t.__esModule=!0;t.addLeadingSlash=function(e){return"/"===e.charAt(0)?e:"/"+e},t.stripLeadingSlash=function(e){return"/"===e.charAt(0)?e.substr(1):e};var n=t.hasBasename=function(e,t){return new RegExp("^"+t+"(\\/|\\?|#|$)","i").test(e)};t.stripBasename=function(e,t){return n(e,t)?e.substr(t.length):e},t.stripTrailingSlash=function(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e},t.parsePath=function(e){var t=e||"/",n="",r="",o=t.indexOf("#");-1!==o&&(r=t.substr(o),t=t.substr(0,o));var a=t.indexOf("?");return-1!==a&&(n=t.substr(a),t=t.substr(0,a)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}},t.createPath=function(e){var t=e.pathname,n=e.search,r=e.hash,o=t||"/";return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),o}}),d=t(function(e,t){function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.locationsAreEqual=t.createLocation=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=n(f),a=n(h);t.createLocation=function(e,t,n,a){var i=void 0;"string"==typeof e?(i=(0,l.parsePath)(e)).state=t:(void 0===(i=r({},e)).pathname&&(i.pathname=""),i.search?"?"!==i.search.charAt(0)&&(i.search="?"+i.search):i.search="",i.hash?"#"!==i.hash.charAt(0)&&(i.hash="#"+i.hash):i.hash="",void 0!==t&&void 0===i.state&&(i.state=t));try{i.pathname=decodeURI(i.pathname)}catch(e){throw e instanceof URIError?new URIError('Pathname "'+i.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):e}return n&&(i.key=n),a?i.pathname?"/"!==i.pathname.charAt(0)&&(i.pathname=(0,o.default)(i.pathname,a.pathname)):i.pathname=a.pathname:i.pathname||(i.pathname="/"),i},t.locationsAreEqual=function(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&e.key===t.key&&(0,a.default)(e.state,t.state)}}),p=t(function(e,t){t.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(i),r=function(){var e=null,t=[];return{setPrompt:function(t){return(0,n.default)(null==e,"A history supports only one prompt at a time"),e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,r,o,a){if(null!=e){var i="function"==typeof e?e(t,r):e;"string"==typeof i?"function"==typeof o?o(i,a):((0,n.default)(!1,"A history needs a getUserConfirmation function in order to use a prompt message"),a(!0)):a(!1!==i)}else a(!0)},appendListener:function(e){var n=!0,r=function(){n&&e.apply(void 0,arguments)};return t.push(r),function(){n=!1,t=t.filter(function(e){return e!==r})}},notifyListeners:function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];t.forEach(function(e){return e.apply(void 0,n)})}}};t.default=r}),v=t(function(e,t){t.__esModule=!0;t.canUseDOM=!("undefined"==typeof window||!window.document||!window.document.createElement),t.addEventListener=function(e,t,n){return e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},t.removeEventListener=function(e,t,n){return e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent("on"+t,n)},t.getConfirmation=function(e,t){return t(window.confirm(e))},t.supportsHistory=function(){var e=window.navigator.userAgent;return(-1===e.indexOf("Android 2.")&&-1===e.indexOf("Android 4.0")||-1===e.indexOf("Mobile Safari")||-1!==e.indexOf("Chrome")||-1!==e.indexOf("Windows Phone"))&&(window.history&&"pushState"in window.history)},t.supportsPopStateOnHashChange=function(){return-1===window.navigator.userAgent.indexOf("Trident")},t.supportsGoWithoutReloadUsingHash=function(){return-1===window.navigator.userAgent.indexOf("Firefox")},t.isExtraneousPopstateEvent=function(e){return void 0===e.state&&-1===navigator.userAgent.indexOf("CriOS")}}),y=function(e){return e&&e.__esModule?e.default:e}(t(function(e,t){function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(i),s=n(u),c=n(p),f=function(){try{return window.history.state||{}}catch(e){return{}}},h=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,s.default)(v.canUseDOM,"Browser history needs a DOM");var t=window.history,n=(0,v.supportsHistory)(),i=!(0,v.supportsPopStateOnHashChange)(),u=e.forceRefresh,h=void 0!==u&&u,p=e.getUserConfirmation,y=void 0===p?v.getConfirmation:p,m=e.keyLength,g=void 0===m?6:m,O=e.basename?(0,l.stripTrailingSlash)((0,l.addLeadingSlash)(e.basename)):"",b=function(e){var t=e||{},n=t.key,r=t.state,o=window.location,i=o.pathname+o.search+o.hash;return(0,a.default)(!O||(0,l.hasBasename)(i,O),'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "'+i+'" to begin with "'+O+'".'),O&&(i=(0,l.stripBasename)(i,O)),(0,d.createLocation)(i,r,n)},w=function(){return Math.random().toString(36).substr(2,g)},E=(0,c.default)(),A=function(e){o(D,e),D.length=t.length,E.notifyListeners(D.location,D.action)},R=function(e){(0,v.isExtraneousPopstateEvent)(e)||L(b(e.state))},j=function(){L(b(f()))},k=!1,L=function(e){if(k)k=!1,A();else{E.confirmTransitionTo(e,"POP",y,function(t){t?A({action:"POP",location:e}):P(e)})}},P=function(e){var t=D.location,n=x.indexOf(t.key);-1===n&&(n=0);var r=x.indexOf(e.key);-1===r&&(r=0);var o=n-r;o&&(k=!0,U(o))},_=b(f()),x=[_.key],S=function(e){return O+(0,l.createPath)(e)},T=function(e,o){(0,a.default)(!("object"===(void 0===e?"undefined":r(e))&&void 0!==e.state&&void 0!==o),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var i=(0,d.createLocation)(e,o,w(),D.location);E.confirmTransitionTo(i,"PUSH",y,function(e){if(e){var r=S(i),o=i.key,u=i.state;if(n)if(t.pushState({key:o,state:u},null,r),h)window.location.href=r;else{var s=x.indexOf(D.location.key),c=x.slice(0,-1===s?0:s+1);c.push(i.key),x=c,A({action:"PUSH",location:i})}else(0,a.default)(void 0===u,"Browser history cannot push state in browsers that do not support HTML5 history"),window.location.href=r}})},C=function(e,o){(0,a.default)(!("object"===(void 0===e?"undefined":r(e))&&void 0!==e.state&&void 0!==o),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var i=(0,d.createLocation)(e,o,w(),D.location);E.confirmTransitionTo(i,"REPLACE",y,function(e){if(e){var r=S(i),o=i.key,u=i.state;if(n)if(t.replaceState({key:o,state:u},null,r),h)window.location.replace(r);else{var s=x.indexOf(D.location.key);-1!==s&&(x[s]=i.key),A({action:"REPLACE",location:i})}else(0,a.default)(void 0===u,"Browser history cannot replace state in browsers that do not support HTML5 history"),window.location.replace(r)}})},U=function(e){t.go(e)},M=function(){return U(-1)},H=function(){return U(1)},B=0,G=function(e){1===(B+=e)?((0,v.addEventListener)(window,"popstate",R),i&&(0,v.addEventListener)(window,"hashchange",j)):0===B&&((0,v.removeEventListener)(window,"popstate",R),i&&(0,v.removeEventListener)(window,"hashchange",j))},N=!1,F=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=E.setPrompt(e);return N||(G(1),N=!0),function(){return N&&(N=!1,G(-1)),t()}},I=function(e){var t=E.appendListener(e);return G(1),function(){G(-1),t()}},D={length:t.length,action:"POP",location:_,createHref:S,push:T,replace:C,go:U,goBack:M,goForward:H,block:F,listen:I};return D};t.default=h})),m=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,b=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,o,a=n(e),i=1;i<arguments.length;i++){r=Object(arguments[i]);for(var u in r)g.call(r,u)&&(a[u]=r[u]);if(m){o=m(r);for(var s=0;s<o.length;s++)O.call(r,o[s])&&(a[o[s]]=r[o[s]])}}return a},w=function(e,t){var n=r(t=b({arrayFormat:"none"},t)),a=Object.create(null);return"string"!=typeof e?a:(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(function(e){var t=e.replace(/\+/g," ").split("="),r=t.shift(),o=t.length>0?t.join("="):void 0;o=void 0===o?null:decodeURIComponent(o),n(decodeURIComponent(r),o,a)}),Object.keys(a).sort().reduce(function(e,t){var n=a[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=o(n):e[t]=n,e},Object.create(null))):a},E="ROUTER/PUSH",A="ROUTER/REPLACE",R="ROUTER/GO",j="ROUTER/GO_BACK",k=function(e){return{type:E,payload:e}},L=function(e){return{type:A,payload:e}},P=function(e){return{type:R,payload:e}},_=function(){return{type:j}},x=function(){return{type:"ROUTER/GO_FORWARD"}},S=function(e){var t=e.pathname,n=e.search,r=e.hash;return{type:"ROUTER/LOCATION_CHANGE",payload:{pathname:t,search:n,queries:w(n),hash:r}}},T=function(e){return function(){return function(t){return function(n){switch(n.type){case E:e.push(n.payload);break;case A:e.replace(n.payload);break;case R:e.go(n.payload);break;case j:e.goBack();break;case"ROUTER/GO_FORWARD":e.goForward();break;default:return t(n)}}}}},C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},U={pathname:"/",search:"",queries:{},hash:""},M=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U,t=arguments[1];switch(t.type){case"ROUTER/LOCATION_CHANGE":return C({},e,t.payload);default:return e}};e.createBrowserHistory=y,e.startListener=a,e.PUSH=E,e.REPLACE=A,e.GO=R,e.GO_BACK=j,e.GO_FORWARD="ROUTER/GO_FORWARD",e.LOCATION_CHANGE="ROUTER/LOCATION_CHANGE",e.push=k,e.replace=L,e.go=P,e.goBack=_,e.goForward=x,e.locationChange=S,e.routerMiddleware=T,e.routerReducer=M,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.ReduxFirstRouting={})}(this,function(e){"use strict";function t(e){return e&&e.__esModule?e.default:e}function n(e,t){return t={exports:{}},e(t,t.exports),t.exports}function r(e){return"/"===e.charAt(0)}function o(e,t){for(var n=t,r=n+1,o=e.length;r<o;n+=1,r+=1)e[n]=e[r];e.pop()}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=e&&e.split("/")||[],a=t&&t.split("/")||[],i=e&&r(e),c=t&&r(t),u=i||c;if(e&&r(e)?a=n:n.length&&(a.pop(),a=a.concat(n)),!a.length)return"/";var s=void 0;if(a.length){var f=a[a.length-1];s="."===f||".."===f||""===f}else s=!1;for(var h=0,l=a.length;l>=0;l--){var d=a[l];"."===d?o(a,l):".."===d?(o(a,l),h++):h&&(o(a,l),h--)}if(!u)for(;h--;h)a.unshift("..");!u||""===a[0]||a[0]&&r(a[0])||a.unshift("");var p=a.join("/");return s&&"/"!==p.substr(-1)&&(p+="/"),p}function i(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(Array.isArray(e))return Array.isArray(t)&&e.length===t.length&&e.every(function(e,n){return i(e,t[n])});var n=void 0===e?"undefined":g(e);if(n!==(void 0===t?"undefined":g(t)))return!1;if("object"===n){var r=e.valueOf(),o=t.valueOf();if(r!==e||o!==t)return i(r,o);var a=Object.keys(e),c=Object.keys(t);return a.length===c.length&&a.every(function(n){return i(e[n],t[n])})}return!1}function c(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function u(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],u(n),u(r))}function s(e){try{return decodeURIComponent(e)}catch(r){for(var t=e.match(T),n=1;n<t.length;n++)e=u(t,n).join(""),t=e.match(T);return e}}function f(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=_.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=s(n[0]);r!==n[0]&&(t[n[0]]=r)}n=_.exec(e)}t["%C2"]="�";for(var o=Object.keys(t),a=0;a<o.length;a++){var i=o[a];e=e.replace(new RegExp(i,"g"),t[i])}return e}function h(e){var t;switch(e.arrayFormat){case"index":return function(e,n,r){t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return function(e,n,r){t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};default:return function(e,t,n){void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}function l(e){return Array.isArray(e)?e.sort():"object"==typeof e?l(Object.keys(e)).sort(function(e,t){return Number(e)-Number(t)}).map(function(t){return e[t]}):e}function d(e,t){t.dispatch(q({pathname:e.location.pathname,search:e.location.search,hash:e.location.hash})),e.listen(function(e){t.dispatch(q({pathname:e.pathname,search:e.search,hash:e.hash}))})}var p=function(){},v=function(e,t,n,r,o,a,i,c){if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,o,a,i,c],f=0;(u=new Error(t.replace(/%s/g,function(){return s[f++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}},y=Object.freeze({default:a}),g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m=Object.freeze({default:i}),O=n(function(e,t){t.__esModule=!0;t.addLeadingSlash=function(e){return"/"===e.charAt(0)?e:"/"+e},t.stripLeadingSlash=function(e){return"/"===e.charAt(0)?e.substr(1):e};var n=t.hasBasename=function(e,t){return new RegExp("^"+t+"(\\/|\\?|#|$)","i").test(e)};t.stripBasename=function(e,t){return n(e,t)?e.substr(t.length):e},t.stripTrailingSlash=function(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e},t.parsePath=function(e){var t=e||"/",n="",r="",o=t.indexOf("#");-1!==o&&(r=t.substr(o),t=t.substr(0,o));var a=t.indexOf("?");return-1!==a&&(n=t.substr(a),t=t.substr(0,a)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}},t.createPath=function(e){var t=e.pathname,n=e.search,r=e.hash,o=t||"/";return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),o}});t(O);var b=y&&a||y,w=m&&i||m,E=n(function(e,t){function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.locationsAreEqual=t.createLocation=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=n(b),a=n(w);t.createLocation=function(e,t,n,a){var i=void 0;"string"==typeof e?(i=(0,O.parsePath)(e)).state=t:(void 0===(i=r({},e)).pathname&&(i.pathname=""),i.search?"?"!==i.search.charAt(0)&&(i.search="?"+i.search):i.search="",i.hash?"#"!==i.hash.charAt(0)&&(i.hash="#"+i.hash):i.hash="",void 0!==t&&void 0===i.state&&(i.state=t));try{i.pathname=decodeURI(i.pathname)}catch(e){throw e instanceof URIError?new URIError('Pathname "'+i.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):e}return n&&(i.key=n),a?i.pathname?"/"!==i.pathname.charAt(0)&&(i.pathname=(0,o.default)(i.pathname,a.pathname)):i.pathname=a.pathname:i.pathname||(i.pathname="/"),i},t.locationsAreEqual=function(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&e.key===t.key&&(0,a.default)(e.state,t.state)}});t(E);var R=n(function(e,t){t.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(p),r=function(){var e=null,t=[];return{setPrompt:function(t){return(0,n.default)(null==e,"A history supports only one prompt at a time"),e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,r,o,a){if(null!=e){var i="function"==typeof e?e(t,r):e;"string"==typeof i?"function"==typeof o?o(i,a):((0,n.default)(!1,"A history needs a getUserConfirmation function in order to use a prompt message"),a(!0)):a(!1!==i)}else a(!0)},appendListener:function(e){var n=!0,r=function(){n&&e.apply(void 0,arguments)};return t.push(r),function(){n=!1,t=t.filter(function(e){return e!==r})}},notifyListeners:function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];t.forEach(function(e){return e.apply(void 0,n)})}}};t.default=r});t(R);var A=n(function(e,t){t.__esModule=!0;t.canUseDOM=!("undefined"==typeof window||!window.document||!window.document.createElement),t.addEventListener=function(e,t,n){return e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},t.removeEventListener=function(e,t,n){return e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent("on"+t,n)},t.getConfirmation=function(e,t){return t(window.confirm(e))},t.supportsHistory=function(){var e=window.navigator.userAgent;return(-1===e.indexOf("Android 2.")&&-1===e.indexOf("Android 4.0")||-1===e.indexOf("Mobile Safari")||-1!==e.indexOf("Chrome")||-1!==e.indexOf("Windows Phone"))&&(window.history&&"pushState"in window.history)},t.supportsPopStateOnHashChange=function(){return-1===window.navigator.userAgent.indexOf("Trident")},t.supportsGoWithoutReloadUsingHash=function(){return-1===window.navigator.userAgent.indexOf("Firefox")},t.isExtraneousPopstateEvent=function(e){return void 0===e.state&&-1===navigator.userAgent.indexOf("CriOS")}});t(A);var j=t(n(function(e,t){function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(p),i=n(v),c=n(R),u=function(){try{return window.history.state||{}}catch(e){return{}}},s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,i.default)(A.canUseDOM,"Browser history needs a DOM");var t=window.history,n=(0,A.supportsHistory)(),s=!(0,A.supportsPopStateOnHashChange)(),f=e.forceRefresh,h=void 0!==f&&f,l=e.getUserConfirmation,d=void 0===l?A.getConfirmation:l,p=e.keyLength,v=void 0===p?6:p,y=e.basename?(0,O.stripTrailingSlash)((0,O.addLeadingSlash)(e.basename)):"",g=function(e){var t=e||{},n=t.key,r=t.state,o=window.location,i=o.pathname+o.search+o.hash;return(0,a.default)(!y||(0,O.hasBasename)(i,y),'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "'+i+'" to begin with "'+y+'".'),y&&(i=(0,O.stripBasename)(i,y)),(0,E.createLocation)(i,r,n)},m=function(){return Math.random().toString(36).substr(2,v)},b=(0,c.default)(),w=function(e){o(D,e),D.length=t.length,b.notifyListeners(D.location,D.action)},R=function(e){(0,A.isExtraneousPopstateEvent)(e)||x(g(e.state))},j=function(){x(g(u()))},k=!1,x=function(e){if(k)k=!1,w();else{b.confirmTransitionTo(e,"POP",d,function(t){t?w({action:"POP",location:e}):L(e)})}},L=function(e){var t=D.location,n=T.indexOf(t.key);-1===n&&(n=0);var r=T.indexOf(e.key);-1===r&&(r=0);var o=n-r;o&&(k=!0,U(o))},P=g(u()),T=[P.key],_=function(e){return y+(0,O.createPath)(e)},C=function(e,o){(0,a.default)(!("object"===(void 0===e?"undefined":r(e))&&void 0!==e.state&&void 0!==o),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var i=(0,E.createLocation)(e,o,m(),D.location);b.confirmTransitionTo(i,"PUSH",d,function(e){if(e){var r=_(i),o=i.key,c=i.state;if(n)if(t.pushState({key:o,state:c},null,r),h)window.location.href=r;else{var u=T.indexOf(D.location.key),s=T.slice(0,-1===u?0:u+1);s.push(i.key),T=s,w({action:"PUSH",location:i})}else(0,a.default)(void 0===c,"Browser history cannot push state in browsers that do not support HTML5 history"),window.location.href=r}})},S=function(e,o){(0,a.default)(!("object"===(void 0===e?"undefined":r(e))&&void 0!==e.state&&void 0!==o),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var i=(0,E.createLocation)(e,o,m(),D.location);b.confirmTransitionTo(i,"REPLACE",d,function(e){if(e){var r=_(i),o=i.key,c=i.state;if(n)if(t.replaceState({key:o,state:c},null,r),h)window.location.replace(r);else{var u=T.indexOf(D.location.key);-1!==u&&(T[u]=i.key),w({action:"REPLACE",location:i})}else(0,a.default)(void 0===c,"Browser history cannot replace state in browsers that do not support HTML5 history"),window.location.replace(r)}})},U=function(e){t.go(e)},M=function(){return U(-1)},F=function(){return U(1)},H=0,B=function(e){1===(H+=e)?((0,A.addEventListener)(window,"popstate",R),s&&(0,A.addEventListener)(window,"hashchange",j)):0===H&&((0,A.removeEventListener)(window,"popstate",R),s&&(0,A.removeEventListener)(window,"hashchange",j))},I=!1,G=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=b.setPrompt(e);return I||(B(1),I=!0),function(){return I&&(I=!1,B(-1)),t()}},N=function(e){var t=b.appendListener(e);return B(1),function(){B(-1),t()}},D={length:t.length,action:"POP",location:P,createHref:_,push:C,replace:S,go:U,goBack:M,goForward:F,block:G,listen:N};return D};t.default=s})),k=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,P=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,o=c(e),a=1;a<arguments.length;a++){n=Object(arguments[a]);for(var i in n)x.call(n,i)&&(o[i]=n[i]);if(k){r=k(n);for(var u=0;u<r.length;u++)L.call(n,r[u])&&(o[r[u]]=n[r[u]])}}return o},T=new RegExp("%[a-f0-9]{2}","gi"),_=new RegExp("(%[a-f0-9]{2})+","gi"),C=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return f(e)}},S=function(e,t){var n=h(t=P({arrayFormat:"none"},t)),r=Object.create(null);return"string"!=typeof e?r:(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(function(e){var t=e.replace(/\+/g," ").split("="),o=t.shift(),a=t.length>0?t.join("="):void 0;a=void 0===a?null:C(a),n(C(o),a,r)}),Object.keys(r).sort().reduce(function(e,t){var n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=l(n):e[t]=n,e},Object.create(null))):r},U="ROUTER/PUSH",M="ROUTER/REPLACE",F="ROUTER/GO",H="ROUTER/GO_BACK",B=function(e){return{type:U,payload:e}},I=function(e){return{type:M,payload:e}},G=function(e){return{type:F,payload:e}},N=function(){return{type:H}},D=function(){return{type:"ROUTER/GO_FORWARD"}},q=function(e){var t=e.pathname,n=e.search,r=e.hash;return{type:"ROUTER/LOCATION_CHANGE",payload:{pathname:t,search:n,queries:S(n),hash:r}}},W=function(e){return function(){return function(t){return function(n){switch(n.type){case U:e.push(n.payload);break;case M:e.replace(n.payload);break;case F:e.go(n.payload);break;case H:e.goBack();break;case"ROUTER/GO_FORWARD":e.goForward();break;default:return t(n)}}}}},$=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Y={pathname:"/",search:"",queries:{},hash:""},z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Y,t=arguments[1];switch(t.type){case"ROUTER/LOCATION_CHANGE":return $({},e,t.payload);default:return e}};e.createBrowserHistory=j,e.startListener=d,e.PUSH=U,e.REPLACE=M,e.GO=F,e.GO_BACK=H,e.GO_FORWARD="ROUTER/GO_FORWARD",e.LOCATION_CHANGE="ROUTER/LOCATION_CHANGE",e.push=B,e.replace=I,e.go=G,e.goBack=N,e.goForward=D,e.locationChange=q,e.routerMiddleware=W,e.routerReducer=z,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "redux-first-routing",
"version": "0.2.2",
"version": "0.3.0",
"description": "Redux-first routing",

@@ -35,26 +35,26 @@ "main": "lib/index.js",

"dependencies": {
"history": "^4.6.3",
"query-string": "^4.3.4"
"history": "^4.7.2",
"query-string": "^5.0.0"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.24.1",
"chai": "^4.1.0",
"cross-env": "^5.0.1",
"eslint": "^3.19.0",
"eslint-config-airbnb-base": "^11.2.0",
"chai": "^4.1.2",
"cross-env": "^5.0.5",
"eslint": "^4.7.1",
"eslint-config-airbnb-base": "^12.0.0",
"eslint-plugin-import": "^2.7.0",
"mocha": "^3.4.1",
"rimraf": "^2.6.1",
"rollup": "^0.45.2",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^8.0.2",
"rollup": "^0.50.0",
"rollup-plugin-babel": "^3.0.2",
"rollup-plugin-commonjs": "^8.2.1",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-replace": "^1.1.1",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-uglify": "^2.0.1",
"sinon": "^2.3.7"
"sinon": "^3.3.0"
},

@@ -61,0 +61,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc