Socket
Socket
Sign inDemoInstall

redux-first-routing

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-first-routing - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

59

dist/redux-first-routing.js

@@ -31,47 +31,6 @@ (function (global, factory) {

var __DEV__ = process.env.NODE_ENV !== 'production';
var warning = function() {};
if (__DEV__) {
warning = function(condition, format, args) {
var len = arguments.length;
args = new Array(len > 2 ? len - 2 : 0);
for (var key = 2; key < len; key++) {
args[key - 2] = arguments[key];
}
if (format === undefined) {
throw new Error(
'`warning(condition, format, ...args)` requires a warning ' +
'message argument'
);
}
var browser = warning;
if (format.length < 10 || (/^[s\W]*$/).test(format)) {
throw new Error(
'The warning format should be able to uniquely identify this ' +
'warning. Please, use a more descriptive format than: ' + format
);
}
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' +
format.replace(/%s/g, function() {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch(x) {}
}
};
}
var warning_1 = warning;
/**

@@ -97,11 +56,3 @@ * Copyright 2013-2015, Facebook, Inc.

var NODE_ENV = process.env.NODE_ENV;
var invariant = function(condition, format, a, b, c, d, e, f) {
if (NODE_ENV !== 'production') {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
if (!condition) {

@@ -128,3 +79,3 @@ var error;

var invariant_1 = invariant;
var browser$2 = invariant;

@@ -378,3 +329,3 @@ var isAbsolute = function isAbsolute(pathname) {

var _warning2 = _interopRequireDefault(warning_1);
var _warning2 = _interopRequireDefault(browser);

@@ -529,7 +480,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _warning2 = _interopRequireDefault(warning_1);
var _warning2 = _interopRequireDefault(browser);
var _invariant2 = _interopRequireDefault(invariant_1);
var _invariant2 = _interopRequireDefault(browser$2);

@@ -536,0 +487,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=e.ReduxFirstRouting||{})}(this,function(e){"use strict";function t(e,t){return t={exports:{}},e(t,t.exports),t.exports}function n(e,t){t.dispatch(_({pathname:e.location.pathname,search:e.location.search,hash:e.location.hash})),e.listen(function(e){t.dispatch(_({pathname:e.pathname,search:e.search,hash:e.hash}))})}function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function o(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 a(e){return Array.isArray(e)?e.sort():"object"==typeof e?a(Object.keys(e)).sort(function(e,t){return Number(e)-Number(t)}).map(function(t){return e[t]}):e}var i=function(){};"production"!==process.env.NODE_ENV&&(i=function(e,t,n){var r=arguments.length;n=new Array(r>2?r-2:0);for(var o=2;o<r;o++)n[o-2]=arguments[o];if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(t.length<10||/^[s\W]*$/.test(t))throw new Error("The warning format should be able to uniquely identify this warning. Please, use a more descriptive format than: "+t);if(!e){var a=0,i="Warning: "+t.replace(/%s/g,function(){return n[a++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}}});var u=i,s=process.env.NODE_ENV,c=function(e,t,n,r,o,a,i,u){if("production"!==s&&void 0===t)throw new Error("invariant requires an error message argument");if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,r,o,a,i,u],d=0;(c=new Error(t.replace(/%s/g,function(){return f[d++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}},f=function(e){return"/"===e.charAt(0)},d=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()},l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=e&&e.split("/")||[],r=t&&t.split("/")||[],o=e&&f(e),a=t&&f(t),i=o||a;if(e&&f(e)?r=n:n.length&&(r.pop(),r=r.concat(n)),!r.length)return"/";var u=void 0;if(r.length){var s=r[r.length-1];u="."===s||".."===s||""===s}else u=!1;for(var c=0,l=r.length;l>=0;l--){var h=r[l];"."===h?d(r,l):".."===h?(d(r,l),c++):c&&(d(r,l),c--)}if(!i)for(;c--;c)r.unshift("..");!i||""===r[0]||r[0]&&f(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}),p=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},t.stripPrefix=function(e,t){return 0===e.indexOf(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)),t=decodeURI(t),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}},t.createPath=function(e){var t=e.pathname,n=e.search,r=e.hash,o=encodeURI(t||"/");return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),o}}),v=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(l),a=n(h);t.createLocation=function(e,t,n,a){var i=void 0;return"string"==typeof e?(i=(0,p.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)),i.key=n,a&&(i.pathname?"/"!==i.pathname.charAt(0)&&(i.pathname=(0,o.default)(i.pathname,a.pathname)):i.pathname=a.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)}}),y=t(function(e,t){t.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(u),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}),g=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")}}),m=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(u),i=n(c),s=n(y),f=function(){try{return window.history.state||{}}catch(e){return{}}},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,i.default)(g.canUseDOM,"Browser history needs a DOM");var t=window.history,n=(0,g.supportsHistory)(),u=!(0,g.supportsPopStateOnHashChange)(),c=e.forceRefresh,d=void 0!==c&&c,l=e.getUserConfirmation,h=void 0===l?g.getConfirmation:l,y=e.keyLength,m=void 0===y?6:y,O=e.basename?(0,p.stripTrailingSlash)((0,p.addLeadingSlash)(e.basename)):"",w=function(e){var t=e||{},n=t.key,r=t.state,a=window.location,i=a.pathname+a.search+a.hash;return O&&(i=(0,p.stripPrefix)(i,O)),o({},(0,p.parsePath)(i),{state:r,key:n})},b=function(){return Math.random().toString(36).substr(2,m)},E=(0,s.default)(),A=function(e){o(q,e),q.length=t.length,E.notifyListeners(q.location,q.action)},R=function(e){(0,g.isExtraneousPopstateEvent)(e)||k(w(e.state))},j=function(){k(w(f()))},P=!1,k=function(e){if(P)P=!1,A();else{E.confirmTransitionTo(e,"POP",h,function(t){t?A({action:"POP",location:e}):_(e)})}},_=function(e){var t=q.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&&(P=!0,U(o))},L=w(f()),x=[L.key],S=function(e){return O+(0,p.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,v.createLocation)(e,o,b(),q.location);E.confirmTransitionTo(i,"PUSH",h,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),d)window.location.href=r;else{var s=x.indexOf(q.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,v.createLocation)(e,o,b(),q.location);E.confirmTransitionTo(i,"REPLACE",h,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),d)window.location.replace(r);else{var s=x.indexOf(q.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)},N=0,G=function(e){1===(N+=e)?((0,g.addEventListener)(window,"popstate",R),u&&(0,g.addEventListener)(window,"hashchange",j)):0===N&&((0,g.removeEventListener)(window,"popstate",R),u&&(0,g.removeEventListener)(window,"hashchange",j))},F=!1,B=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=E.setPrompt(e);return F||(G(1),F=!0),function(){return F&&(F=!1,G(-1)),t()}},I=function(e){var t=E.appendListener(e);return G(1),function(){G(-1),t()}},q={length:t.length,action:"POP",location:L,createHref:S,push:T,replace:C,go:U,goBack:M,goForward:H,block:B,listen:I};return q};t.default=d})),O="ROUTER/PUSH",w="ROUTER/REPLACE",b="ROUTER/GO",E="ROUTER/GO_BACK",A=function(e){return{type:O,payload:e}},R=function(e){return{type:w,payload:e}},j=function(e){return{type:b,payload:e}},P=function(){return{type:E}},k=function(){return{type:"ROUTER/GO_FORWARD"}},_=function(e){return{type:"ROUTER/LOCATION_CHANGE",payload:{pathname:e.pathname,search:e.search,hash:e.hash}}},L=function(e){return function(){return function(t){return function(n){switch(n.type){case O:e.push(n.payload);break;case w:e.replace(n.payload);break;case b:e.go(n.payload);break;case E:e.goBack();break;case"ROUTER/GO_FORWARD":e.goForward();break;default:return t(n)}}}}},x=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,C=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,o,a=r(e),i=1;i<arguments.length;i++){n=Object(arguments[i]);for(var u in n)S.call(n,u)&&(a[u]=n[u]);if(x){o=x(n);for(var s=0;s<o.length;s++)T.call(n,o[s])&&(a[o[s]]=n[o[s]])}}return a},U=function(e,t){var n=o(t=C({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:decodeURIComponent(a),n(decodeURIComponent(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]=a(n):e[t]=n,e},Object.create(null))):r},M={pathname:"/",search:"",queries:{},hash:""},H=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M,t=arguments[1];switch(t.type){case"ROUTER/LOCATION_CHANGE":return{pathname:t.payload.pathname,search:t.payload.search,queries:U(t.payload.search),hash:t.payload.hash};default:return e}};e.createBrowserHistory=m,e.startListener=n,e.PUSH=O,e.REPLACE=w,e.GO=b,e.GO_BACK=E,e.GO_FORWARD="ROUTER/GO_FORWARD",e.LOCATION_CHANGE="ROUTER/LOCATION_CHANGE",e.push=A,e.replace=R,e.go=j,e.goBack=P,e.goForward=k,e.locationChange=_,e.routerMiddleware=L,e.routerReducer=H,Object.defineProperty(e,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.ReduxFirstRouting=t.ReduxFirstRouting||{})}(this,function(t){"use strict";function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}function n(t,e){e.dispatch(k({pathname:t.location.pathname,search:t.location.search,hash:t.location.hash})),t.listen(function(t){e.dispatch(k({pathname:t.pathname,search:t.search,hash:t.hash}))})}function r(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function o(t){var e;switch(t.arrayFormat){case"index":return function(t,n,r){e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===r[t]&&(r[t]={}),r[t][e[1]]=n):r[t]=n};case"bracket":return function(t,n,r){e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==r[t]?r[t]=[].concat(r[t],n):r[t]=[n]:r[t]=n};default:return function(t,e,n){void 0!==n[t]?n[t]=[].concat(n[t],e):n[t]=e}}}function a(t){return Array.isArray(t)?t.sort():"object"==typeof t?a(Object.keys(t)).sort(function(t,e){return Number(t)-Number(e)}).map(function(e){return t[e]}):t}var i=function(){},u=function(t,e,n,r,o,a,i,u){if(!t){var s;if(void 0===e)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(e.replace(/%s/g,function(){return c[f++]}))).name="Invariant Violation"}throw s.framesToPop=1,s}},s=function(t){return"/"===t.charAt(0)},c=function(t,e){for(var n=e,r=n+1,o=t.length;r<o;n+=1,r+=1)t[n]=t[r];t.pop()},f=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=t&&t.split("/")||[],r=e&&e.split("/")||[],o=t&&s(t),a=e&&s(e),i=o||a;if(t&&s(t)?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 d=0,l=r.length;l>=0;l--){var h=r[l];"."===h?c(r,l):".."===h?(c(r,l),d++):d&&(c(r,l),d--)}if(!i)for(;d--;d)r.unshift("..");!i||""===r[0]||r[0]&&s(r[0])||r.unshift("");var p=r.join("/");return u&&"/"!==p.substr(-1)&&(p+="/"),p},d=e(function(t,e){e.__esModule=!0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function t(e,r){if(e===r)return!0;if(null==e||null==r)return!1;if(Array.isArray(e))return Array.isArray(r)&&e.length===r.length&&e.every(function(e,n){return t(e,r[n])});var o=void 0===e?"undefined":n(e);if(o!==(void 0===r?"undefined":n(r)))return!1;if("object"===o){var a=e.valueOf(),i=r.valueOf();if(a!==e||i!==r)return t(a,i);var u=Object.keys(e),s=Object.keys(r);return u.length===s.length&&u.every(function(n){return t(e[n],r[n])})}return!1};e.default=r}),l=e(function(t,e){e.__esModule=!0;e.addLeadingSlash=function(t){return"/"===t.charAt(0)?t:"/"+t},e.stripLeadingSlash=function(t){return"/"===t.charAt(0)?t.substr(1):t},e.stripPrefix=function(t,e){return 0===t.indexOf(e)?t.substr(e.length):t},e.stripTrailingSlash=function(t){return"/"===t.charAt(t.length-1)?t.slice(0,-1):t},e.parsePath=function(t){var e=t||"/",n="",r="",o=e.indexOf("#");-1!==o&&(r=e.substr(o),e=e.substr(0,o));var a=e.indexOf("?");return-1!==a&&(n=e.substr(a),e=e.substr(0,a)),e=decodeURI(e),{pathname:e,search:"?"===n?"":n,hash:"#"===r?"":r}},e.createPath=function(t){var e=t.pathname,n=t.search,r=t.hash,o=encodeURI(e||"/");return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),o}}),h=e(function(t,e){function n(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.locationsAreEqual=e.createLocation=void 0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},o=n(f),a=n(d);e.createLocation=function(t,e,n,a){var i=void 0;return"string"==typeof t?(i=(0,l.parsePath)(t)).state=e:(void 0===(i=r({},t)).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!==e&&void 0===i.state&&(i.state=e)),i.key=n,a&&(i.pathname?"/"!==i.pathname.charAt(0)&&(i.pathname=(0,o.default)(i.pathname,a.pathname)):i.pathname=a.pathname),i},e.locationsAreEqual=function(t,e){return t.pathname===e.pathname&&t.search===e.search&&t.hash===e.hash&&t.key===e.key&&(0,a.default)(t.state,e.state)}}),p=e(function(t,e){e.__esModule=!0;var n=function(t){return t&&t.__esModule?t:{default:t}}(i),r=function(){var t=null,e=[];return{setPrompt:function(e){return(0,n.default)(null==t,"A history supports only one prompt at a time"),t=e,function(){t===e&&(t=null)}},confirmTransitionTo:function(e,r,o,a){if(null!=t){var i="function"==typeof t?t(e,r):t;"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(t){var n=!0,r=function(){n&&t.apply(void 0,arguments)};return e.push(r),function(){n=!1,e=e.filter(function(t){return t!==r})}},notifyListeners:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];e.forEach(function(t){return t.apply(void 0,n)})}}};e.default=r}),y=e(function(t,e){e.__esModule=!0;e.canUseDOM=!("undefined"==typeof window||!window.document||!window.document.createElement),e.addEventListener=function(t,e,n){return t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)},e.removeEventListener=function(t,e,n){return t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent("on"+e,n)},e.getConfirmation=function(t,e){return e(window.confirm(t))},e.supportsHistory=function(){var t=window.navigator.userAgent;return(-1===t.indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&(window.history&&"pushState"in window.history)},e.supportsPopStateOnHashChange=function(){return-1===window.navigator.userAgent.indexOf("Trident")},e.supportsGoWithoutReloadUsingHash=function(){return-1===window.navigator.userAgent.indexOf("Firefox")},e.isExtraneousPopstateEvent=function(t){return void 0===t.state&&-1===navigator.userAgent.indexOf("CriOS")}}),v=function(t){return t&&t.__esModule?t.default:t}(e(function(t,e){function n(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},a=n(i),s=n(u),c=n(p),f=function(){try{return window.history.state||{}}catch(t){return{}}},d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,s.default)(y.canUseDOM,"Browser history needs a DOM");var e=window.history,n=(0,y.supportsHistory)(),i=!(0,y.supportsPopStateOnHashChange)(),u=t.forceRefresh,d=void 0!==u&&u,p=t.getUserConfirmation,v=void 0===p?y.getConfirmation:p,g=t.keyLength,m=void 0===g?6:g,O=t.basename?(0,l.stripTrailingSlash)((0,l.addLeadingSlash)(t.basename)):"",b=function(t){var e=t||{},n=e.key,r=e.state,a=window.location,i=a.pathname+a.search+a.hash;return O&&(i=(0,l.stripPrefix)(i,O)),o({},(0,l.parsePath)(i),{state:r,key:n})},w=function(){return Math.random().toString(36).substr(2,m)},E=(0,c.default)(),A=function(t){o(D,t),D.length=e.length,E.notifyListeners(D.location,D.action)},R=function(t){(0,y.isExtraneousPopstateEvent)(t)||P(b(t.state))},j=function(){P(b(f()))},k=!1,P=function(t){if(k)k=!1,A();else{E.confirmTransitionTo(t,"POP",v,function(e){e?A({action:"POP",location:t}):L(t)})}},L=function(t){var e=D.location,n=x.indexOf(e.key);-1===n&&(n=0);var r=x.indexOf(t.key);-1===r&&(r=0);var o=n-r;o&&(k=!0,U(o))},_=b(f()),x=[_.key],S=function(t){return O+(0,l.createPath)(t)},T=function(t,o){(0,a.default)(!("object"===(void 0===t?"undefined":r(t))&&void 0!==t.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,h.createLocation)(t,o,w(),D.location);E.confirmTransitionTo(i,"PUSH",v,function(t){if(t){var r=S(i),o=i.key,u=i.state;if(n)if(e.pushState({key:o,state:u},null,r),d)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(t,o){(0,a.default)(!("object"===(void 0===t?"undefined":r(t))&&void 0!==t.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,h.createLocation)(t,o,w(),D.location);E.confirmTransitionTo(i,"REPLACE",v,function(t){if(t){var r=S(i),o=i.key,u=i.state;if(n)if(e.replaceState({key:o,state:u},null,r),d)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(t){e.go(t)},M=function(){return U(-1)},H=function(){return U(1)},G=0,F=function(t){1===(G+=t)?((0,y.addEventListener)(window,"popstate",R),i&&(0,y.addEventListener)(window,"hashchange",j)):0===G&&((0,y.removeEventListener)(window,"popstate",R),i&&(0,y.removeEventListener)(window,"hashchange",j))},N=!1,B=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=E.setPrompt(t);return N||(F(1),N=!0),function(){return N&&(N=!1,F(-1)),e()}},I=function(t){var e=E.appendListener(t);return F(1),function(){F(-1),e()}},D={length:e.length,action:"POP",location:_,createHref:S,push:T,replace:C,go:U,goBack:M,goForward:H,block:B,listen:I};return D};e.default=d})),g="ROUTER/PUSH",m="ROUTER/REPLACE",O="ROUTER/GO",b="ROUTER/GO_BACK",w=function(t){return{type:g,payload:t}},E=function(t){return{type:m,payload:t}},A=function(t){return{type:O,payload:t}},R=function(){return{type:b}},j=function(){return{type:"ROUTER/GO_FORWARD"}},k=function(t){return{type:"ROUTER/LOCATION_CHANGE",payload:{pathname:t.pathname,search:t.search,hash:t.hash}}},P=function(t){return function(){return function(e){return function(n){switch(n.type){case g:t.push(n.payload);break;case m:t.replace(n.payload);break;case O:t.go(n.payload);break;case b:t.goBack();break;case"ROUTER/GO_FORWARD":t.goForward();break;default:return e(n)}}}}},L=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,S=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,o,a=r(t),i=1;i<arguments.length;i++){n=Object(arguments[i]);for(var u in n)_.call(n,u)&&(a[u]=n[u]);if(L){o=L(n);for(var s=0;s<o.length;s++)x.call(n,o[s])&&(a[o[s]]=n[o[s]])}}return a},T=function(t,e){var n=o(e=S({arrayFormat:"none"},e)),r=Object.create(null);return"string"!=typeof t?r:(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var e=t.replace(/\+/g," ").split("="),o=e.shift(),a=e.length>0?e.join("="):void 0;a=void 0===a?null:decodeURIComponent(a),n(decodeURIComponent(o),a,r)}),Object.keys(r).sort().reduce(function(t,e){var n=r[e];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?t[e]=a(n):t[e]=n,t},Object.create(null))):r},C={pathname:"/",search:"",queries:{},hash:""},U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:C,e=arguments[1];switch(e.type){case"ROUTER/LOCATION_CHANGE":return{pathname:e.payload.pathname,search:e.payload.search,queries:T(e.payload.search),hash:e.payload.hash};default:return t}};t.createBrowserHistory=v,t.startListener=n,t.PUSH=g,t.REPLACE=m,t.GO=O,t.GO_BACK=b,t.GO_FORWARD="ROUTER/GO_FORWARD",t.LOCATION_CHANGE="ROUTER/LOCATION_CHANGE",t.push=w,t.replace=E,t.go=A,t.goBack=R,t.goForward=j,t.locationChange=k,t.routerMiddleware=P,t.routerReducer=U,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "redux-first-routing",
"version": "0.1.2",
"version": "0.1.3",
"description": "Redux-first routing",

@@ -55,2 +55,3 @@ "main": "lib/index.js",

"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-replace": "^1.1.1",
"rollup-plugin-uglify": "^2.0.1",

@@ -57,0 +58,0 @@ "sinon": "^2.3.2"

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