Comparing version 0.5.3 to 0.5.4
@@ -1,2 +0,2 @@ | ||
var t=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t};function n(t,e){return t===e||typeof t==typeof e&&("object"==typeof t?Array.isArray(t)?!!Array.isArray(e)&&(o=n,(r=t).length===(i=e).length&&r.every(function(t,n){return o(t,i[n])})):t instanceof Map?e instanceof Map&&function(t,n,e){if(t.size!==n.size)return!1;var r=[];return t.forEach(function(t,n){r.push(n)}),r.every(function(r){var i=t.get(r),o=n.get(r);return e(i,o)})}(t,e,n):t instanceof Set?e instanceof Set&&function(t,n){if(t.size!==n.size)return!1;var e=[];return t.forEach(function(t){e.push(t)}),e.every(function(t){return n.has(t)})}(t,e):function(t,n,e){var r=Object.keys(t),i=Object.keys(n);if(r.length!==i.length)return!1;var o={}.hasOwnProperty.bind(n);return r.every(function(r,i){return o(r)&&e(t[r],n[r])})}(t,e,n):t===e);var r,i,o}var e,r,i=(e=function(n,e,r,i){return Object.keys(n).reduce(function(o,s){return t({},o,((u={})[s]=(a=n[s],c=s,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=e(),s=a(o,r()).apply(void 0,t);i(s,{name:c,args:t})}),u));var a,c,u},{})},void 0===(r=!1)&&(r=!1),function(){function i(i,o,s){void 0===i&&(i={}),void 0===o&&(o={}),void 0===s&&(s=[]);var a=this;this.connections=[],this.getActions=function(t){return null===t?{}:t?t(a.actions):a.actions},this.getState=function(t){return null===t?{}:t?t(a.state):a.state},this.setState=function(e,r){void 0===r&&(r={}),void 0===e||n(a.state,e)||(a.middlewares&&a.middlewares.length>0&&(e=a.middlewares.reduce(function(t,n){return n(t,{args:r.args,name:r.name,prevState:a.getState()})},e)),a.state=Array.isArray(a.state)?e.slice():"object"==typeof a.state?t({},a.state,e):e,a.emit())},this.connect=function(t){void 0===t&&(t={});var e=t.mapStateToProps,r=t.mapActionsToProps,i=t.force,o=void 0!==i&&i,s=t.leading,c=void 0!==s&&s,u=a.getState(e);return function(t){var i=function(){var i=a.getState(e);!o&&n(u,i)||(u=i,t(i,a.getActions(r)))};return c&&t(u,a.getActions(r)),a.connections.push(i),{dispose:function(){a.dispose(i)}}}},this.state=i,this.actions=e(o,this.getState,this.getActions,this.setState),this.__IS_COMBINED_STORE__=r,this.__INITIAL_ACTIONS__=o,this.__MIDDLEWARES__=s}return i.prototype.emit=function(){this.connections.forEach(function(t){return t()})},i.prototype.dispose=function(t){this.connections=this.connections.filter(function(n){return n!==t})},i}());export{i as Store}; | ||
var t=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t};function n(t,e){return t===e||typeof t==typeof e&&("object"==typeof t?Array.isArray(t)?!!Array.isArray(e)&&(o=n,(r=t).length===(i=e).length&&r.every(function(t,n){return o(t,i[n])})):t instanceof Map?e instanceof Map&&function(t,n,e){if(t.size!==n.size)return!1;var r=[];return t.forEach(function(t,n){r.push(n)}),r.every(function(r){var i=t.get(r),o=n.get(r);return e(i,o)})}(t,e,n):t instanceof Set?e instanceof Set&&function(t,n){if(t.size!==n.size)return!1;var e=[];return t.forEach(function(t){e.push(t)}),e.every(function(t){return n.has(t)})}(t,e):function(t,n,e){var r=Object.keys(t),i=Object.keys(n);if(r.length!==i.length)return!1;var o={}.hasOwnProperty.bind(n);return r.every(function(r,i){return o(r)&&e(t[r],n[r])})}(t,e,n):t===e);var r,i,o}var e,r,i=(e=function(t,n,e,r){return Object.keys(t).reduce(function(i,o){var s,a;return i[o]=(s=t[o],a=o,function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var o=n(),c=s(o,e()).apply(void 0,t);r(c,{name:a,args:t})}),i},{})},void 0===(r=!1)&&(r=!1),function(){function i(i,o,s){void 0===i&&(i={}),void 0===o&&(o={}),void 0===s&&(s=[]);var a=this;this.connections=[],this.getActions=function(t){return null===t?{}:t?t(a.actions):a.actions},this.getState=function(t){return null===t?{}:t?t(a.state):a.state},this.setState=function(e,r){void 0===r&&(r={}),void 0===e||n(a.state,e)||(a.middlewares&&a.middlewares.length>0&&(e=a.middlewares.reduce(function(t,n){return n(t,{args:r.args,name:r.name,prevState:a.getState()})},e)),a.state=Array.isArray(a.state)?e.slice():"object"==typeof a.state?t({},a.state,e):e,a.emit())},this.connect=function(t){void 0===t&&(t={});var e=t.mapStateToProps,r=t.mapActionsToProps,i=t.force,o=void 0!==i&&i,s=t.leading,c=void 0!==s&&s,u=a.getState(e);return function(t){var i=function(){var i=a.getState(e);!o&&n(u,i)||(u=i,t(i,a.getActions(r)))};return c&&t(u,a.getActions(r)),a.connections.push(i),{dispose:function(){a.dispose(i)}}}},this.state=i,this.actions=e(o,this.getState,this.getActions,this.setState),this.__IS_COMBINED_STORE__=r,this.__INITIAL_ACTIONS__=o,this.__MIDDLEWARES__=s}return i.prototype.emit=function(){this.connections.forEach(function(t){return t()})},i.prototype.dispose=function(t){this.connections=this.connections.filter(function(n){return n!==t})},i}());export{i as Store}; | ||
//# sourceMappingURL=mehdux.esm.js.map |
@@ -1,2 +0,2 @@ | ||
var t=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t};function n(t,e){return t===e||typeof t==typeof e&&("object"==typeof t?Array.isArray(t)?!!Array.isArray(e)&&(o=n,(r=t).length===(i=e).length&&r.every(function(t,n){return o(t,i[n])})):t instanceof Map?e instanceof Map&&function(t,n,e){if(t.size!==n.size)return!1;var r=[];return t.forEach(function(t,n){r.push(n)}),r.every(function(r){var i=t.get(r),o=n.get(r);return e(i,o)})}(t,e,n):t instanceof Set?e instanceof Set&&function(t,n){if(t.size!==n.size)return!1;var e=[];return t.forEach(function(t){e.push(t)}),e.every(function(t){return n.has(t)})}(t,e):function(t,n,e){var r=Object.keys(t),i=Object.keys(n);if(r.length!==i.length)return!1;var o={}.hasOwnProperty.bind(n);return r.every(function(r,i){return o(r)&&e(t[r],n[r])})}(t,e,n):t===e);var r,i,o}var e,r,i=(e=function(n,e,r,i){return Object.keys(n).reduce(function(o,s){return t({},o,((u={})[s]=(a=n[s],c=s,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=e(),s=a(o,r()).apply(void 0,t);i(s,{name:c,args:t})}),u));var a,c,u},{})},void 0===(r=!1)&&(r=!1),function(){function i(i,o,s){void 0===i&&(i={}),void 0===o&&(o={}),void 0===s&&(s=[]);var a=this;this.connections=[],this.getActions=function(t){return null===t?{}:t?t(a.actions):a.actions},this.getState=function(t){return null===t?{}:t?t(a.state):a.state},this.setState=function(e,r){void 0===r&&(r={}),void 0===e||n(a.state,e)||(a.middlewares&&a.middlewares.length>0&&(e=a.middlewares.reduce(function(t,n){return n(t,{args:r.args,name:r.name,prevState:a.getState()})},e)),a.state=Array.isArray(a.state)?e.slice():"object"==typeof a.state?t({},a.state,e):e,a.emit())},this.connect=function(t){void 0===t&&(t={});var e=t.mapStateToProps,r=t.mapActionsToProps,i=t.force,o=void 0!==i&&i,s=t.leading,c=void 0!==s&&s,u=a.getState(e);return function(t){var i=function(){var i=a.getState(e);!o&&n(u,i)||(u=i,t(i,a.getActions(r)))};return c&&t(u,a.getActions(r)),a.connections.push(i),{dispose:function(){a.dispose(i)}}}},this.state=i,this.actions=e(o,this.getState,this.getActions,this.setState),this.__IS_COMBINED_STORE__=r,this.__INITIAL_ACTIONS__=o,this.__MIDDLEWARES__=s}return i.prototype.emit=function(){this.connections.forEach(function(t){return t()})},i.prototype.dispose=function(t){this.connections=this.connections.filter(function(n){return n!==t})},i}());exports.Store=i; | ||
var t=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t};function n(t,e){return t===e||typeof t==typeof e&&("object"==typeof t?Array.isArray(t)?!!Array.isArray(e)&&(o=n,(r=t).length===(i=e).length&&r.every(function(t,n){return o(t,i[n])})):t instanceof Map?e instanceof Map&&function(t,n,e){if(t.size!==n.size)return!1;var r=[];return t.forEach(function(t,n){r.push(n)}),r.every(function(r){var i=t.get(r),o=n.get(r);return e(i,o)})}(t,e,n):t instanceof Set?e instanceof Set&&function(t,n){if(t.size!==n.size)return!1;var e=[];return t.forEach(function(t){e.push(t)}),e.every(function(t){return n.has(t)})}(t,e):function(t,n,e){var r=Object.keys(t),i=Object.keys(n);if(r.length!==i.length)return!1;var o={}.hasOwnProperty.bind(n);return r.every(function(r,i){return o(r)&&e(t[r],n[r])})}(t,e,n):t===e);var r,i,o}var e,r,i=(e=function(t,n,e,r){return Object.keys(t).reduce(function(i,o){var s,a;return i[o]=(s=t[o],a=o,function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var o=n(),c=s(o,e()).apply(void 0,t);r(c,{name:a,args:t})}),i},{})},void 0===(r=!1)&&(r=!1),function(){function i(i,o,s){void 0===i&&(i={}),void 0===o&&(o={}),void 0===s&&(s=[]);var a=this;this.connections=[],this.getActions=function(t){return null===t?{}:t?t(a.actions):a.actions},this.getState=function(t){return null===t?{}:t?t(a.state):a.state},this.setState=function(e,r){void 0===r&&(r={}),void 0===e||n(a.state,e)||(a.middlewares&&a.middlewares.length>0&&(e=a.middlewares.reduce(function(t,n){return n(t,{args:r.args,name:r.name,prevState:a.getState()})},e)),a.state=Array.isArray(a.state)?e.slice():"object"==typeof a.state?t({},a.state,e):e,a.emit())},this.connect=function(t){void 0===t&&(t={});var e=t.mapStateToProps,r=t.mapActionsToProps,i=t.force,o=void 0!==i&&i,s=t.leading,c=void 0!==s&&s,u=a.getState(e);return function(t){var i=function(){var i=a.getState(e);!o&&n(u,i)||(u=i,t(i,a.getActions(r)))};return c&&t(u,a.getActions(r)),a.connections.push(i),{dispose:function(){a.dispose(i)}}}},this.state=i,this.actions=e(o,this.getState,this.getActions,this.setState),this.__IS_COMBINED_STORE__=r,this.__INITIAL_ACTIONS__=o,this.__MIDDLEWARES__=s}return i.prototype.emit=function(){this.connections.forEach(function(t){return t()})},i.prototype.dispose=function(t){this.connections=this.connections.filter(function(n){return n!==t})},i}());exports.Store=i; | ||
//# sourceMappingURL=mehdux.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.mehdux={})}(this,function(t){var e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t};function n(t,e){return t===e||typeof t==typeof e&&("object"==typeof t?Array.isArray(t)?!!Array.isArray(e)&&(o=n,(r=t).length===(i=e).length&&r.every(function(t,e){return o(t,i[e])})):t instanceof Map?e instanceof Map&&function(t,e,n){if(t.size!==e.size)return!1;var r=[];return t.forEach(function(t,e){r.push(e)}),r.every(function(r){var i=t.get(r),o=e.get(r);return n(i,o)})}(t,e,n):t instanceof Set?e instanceof Set&&function(t,e){if(t.size!==e.size)return!1;var n=[];return t.forEach(function(t){n.push(t)}),n.every(function(t){return e.has(t)})}(t,e):function(t,e,n){var r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;var o={}.hasOwnProperty.bind(e);return r.every(function(r,i){return o(r)&&n(t[r],e[r])})}(t,e,n):t===e);var r,i,o}var r,i,o=(r=function(t,n,r,i){return Object.keys(t).reduce(function(o,s){return e({},o,((u={})[s]=(a=t[s],c=s,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var o=n(),s=a(o,r()).apply(void 0,t);i(s,{name:c,args:t})}),u));var a,c,u},{})},void 0===(i=!1)&&(i=!1),function(){function t(t,o,s){void 0===t&&(t={}),void 0===o&&(o={}),void 0===s&&(s=[]);var a=this;this.connections=[],this.getActions=function(t){return null===t?{}:t?t(a.actions):a.actions},this.getState=function(t){return null===t?{}:t?t(a.state):a.state},this.setState=function(t,r){void 0===r&&(r={}),void 0===t||n(a.state,t)||(a.middlewares&&a.middlewares.length>0&&(t=a.middlewares.reduce(function(t,e){return e(t,{args:r.args,name:r.name,prevState:a.getState()})},t)),a.state=Array.isArray(a.state)?t.slice():"object"==typeof a.state?e({},a.state,t):t,a.emit())},this.connect=function(t){void 0===t&&(t={});var e=t.mapStateToProps,r=t.mapActionsToProps,i=t.force,o=void 0!==i&&i,s=t.leading,c=void 0!==s&&s,u=a.getState(e);return function(t){var i=function(){var i=a.getState(e);!o&&n(u,i)||(u=i,t(i,a.getActions(r)))};return c&&t(u,a.getActions(r)),a.connections.push(i),{dispose:function(){a.dispose(i)}}}},this.state=t,this.actions=r(o,this.getState,this.getActions,this.setState),this.__IS_COMBINED_STORE__=i,this.__INITIAL_ACTIONS__=o,this.__MIDDLEWARES__=s}return t.prototype.emit=function(){this.connections.forEach(function(t){return t()})},t.prototype.dispose=function(t){this.connections=this.connections.filter(function(e){return e!==t})},t}());t.Store=o}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.mehdux={})}(this,function(t){var e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t};function n(t,e){return t===e||typeof t==typeof e&&("object"==typeof t?Array.isArray(t)?!!Array.isArray(e)&&(o=n,(r=t).length===(i=e).length&&r.every(function(t,e){return o(t,i[e])})):t instanceof Map?e instanceof Map&&function(t,e,n){if(t.size!==e.size)return!1;var r=[];return t.forEach(function(t,e){r.push(e)}),r.every(function(r){var i=t.get(r),o=e.get(r);return n(i,o)})}(t,e,n):t instanceof Set?e instanceof Set&&function(t,e){if(t.size!==e.size)return!1;var n=[];return t.forEach(function(t){n.push(t)}),n.every(function(t){return e.has(t)})}(t,e):function(t,e,n){var r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;var o={}.hasOwnProperty.bind(e);return r.every(function(r,i){return o(r)&&n(t[r],e[r])})}(t,e,n):t===e);var r,i,o}var r,i,o=(r=function(t,e,n,r){return Object.keys(t).reduce(function(i,o){var s,a;return i[o]=(s=t[o],a=o,function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var o=e(),c=s(o,n()).apply(void 0,t);r(c,{name:a,args:t})}),i},{})},void 0===(i=!1)&&(i=!1),function(){function t(t,o,s){void 0===t&&(t={}),void 0===o&&(o={}),void 0===s&&(s=[]);var a=this;this.connections=[],this.getActions=function(t){return null===t?{}:t?t(a.actions):a.actions},this.getState=function(t){return null===t?{}:t?t(a.state):a.state},this.setState=function(t,r){void 0===r&&(r={}),void 0===t||n(a.state,t)||(a.middlewares&&a.middlewares.length>0&&(t=a.middlewares.reduce(function(t,e){return e(t,{args:r.args,name:r.name,prevState:a.getState()})},t)),a.state=Array.isArray(a.state)?t.slice():"object"==typeof a.state?e({},a.state,t):t,a.emit())},this.connect=function(t){void 0===t&&(t={});var e=t.mapStateToProps,r=t.mapActionsToProps,i=t.force,o=void 0!==i&&i,s=t.leading,c=void 0!==s&&s,u=a.getState(e);return function(t){var i=function(){var i=a.getState(e);!o&&n(u,i)||(u=i,t(i,a.getActions(r)))};return c&&t(u,a.getActions(r)),a.connections.push(i),{dispose:function(){a.dispose(i)}}}},this.state=t,this.actions=r(o,this.getState,this.getActions,this.setState),this.__IS_COMBINED_STORE__=i,this.__INITIAL_ACTIONS__=o,this.__MIDDLEWARES__=s}return t.prototype.emit=function(){this.connections.forEach(function(t){return t()})},t.prototype.dispose=function(t){this.connections=this.connections.filter(function(e){return e!==t})},t}());t.Store=o}); | ||
//# sourceMappingURL=mehdux.umd.js.map |
@@ -7,3 +7,3 @@ { | ||
"license": "MIT", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"source": "src/main.ts", | ||
@@ -10,0 +10,0 @@ "main": "dist/mehdux.js", |
@@ -23,9 +23,6 @@ import { | ||
} | ||
// return mapObj(actions, returnFn) | ||
return Object.keys(actions).reduce((pv, cv) => { | ||
return { | ||
...pv, | ||
[cv]: returnFn(actions[cv], cv) | ||
} | ||
pv[cv] = returnFn(actions[cv], cv) | ||
return pv | ||
}, {}) | ||
@@ -54,11 +51,8 @@ } | ||
return Object.keys(actions).reduce((pv, cv) => { | ||
return { | ||
...pv, | ||
[cv]: Object.keys(actions[cv]).reduce((pInnerV, cInnerV) => { | ||
return { | ||
...pInnerV, | ||
[cInnerV]: transformFn(cv, cInnerV, actions[cv][cInnerV]) | ||
} | ||
}, {}) | ||
} | ||
pv[cv] = Object.keys(actions[cv]).reduce((pInnerV, cInnerV) => { | ||
pInnerV[cInnerV] = transformFn(cv, cInnerV, actions[cv][cInnerV]) | ||
return pInnerV | ||
}, {}) | ||
return pv | ||
}, {}) | ||
@@ -65,0 +59,0 @@ } |
@@ -1,2 +0,2 @@ | ||
var t=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t};function e(t,n){return t===n||typeof t==typeof n&&("object"==typeof t?Array.isArray(t)?!!Array.isArray(n)&&(i=e,(r=t).length===(o=n).length&&r.every(function(t,e){return i(t,o[e])})):t instanceof Map?n instanceof Map&&function(t,e,n){if(t.size!==e.size)return!1;var r=[];return t.forEach(function(t,e){r.push(e)}),r.every(function(r){var o=t.get(r),i=e.get(r);return n(o,i)})}(t,n,e):t instanceof Set?n instanceof Set&&function(t,e){if(t.size!==e.size)return!1;var n=[];return t.forEach(function(t){n.push(t)}),n.every(function(t){return e.has(t)})}(t,n):function(t,e,n){var r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;var i={}.hasOwnProperty.bind(e);return r.every(function(r,o){return i(r)&&n(t[r],e[r])})}(t,n,e):t===n);var r,o,i}var n,r,o=function(t){return[].concat.apply([],t)},i=(n=function(e,n,r,o){return Object.keys(e).reduce(function(i,a){return t({},i,((s={})[a]=Object.keys(e[a]).reduce(function(i,s){return t({},i,((p={})[s]=(c=a,u=s,f=e[a][s],function(){for(var e,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];o(((e={})[c]=t({},f(n()[c],r()).apply(void 0,i)),e),{name:c+"."+u,args:i})}),p));var c,u,f,p},{}),s));var s},{})},void 0===(r=!0)&&(r=!1),function(){function o(o,i,a){void 0===o&&(o={}),void 0===i&&(i={}),void 0===a&&(a=[]);var s=this;this.connections=[],this.getActions=function(t){return null===t?{}:t?t(s.actions):s.actions},this.getState=function(t){return null===t?{}:t?t(s.state):s.state},this.setState=function(n,r){void 0===r&&(r={}),void 0===n||e(s.state,n)||(s.middlewares&&s.middlewares.length>0&&(n=s.middlewares.reduce(function(t,e){return e(t,{args:r.args,name:r.name,prevState:s.getState()})},n)),s.state=Array.isArray(s.state)?n.slice():"object"==typeof s.state?t({},s.state,n):n,s.emit())},this.connect=function(t){void 0===t&&(t={});var n=t.mapStateToProps,r=t.mapActionsToProps,o=t.force,i=void 0!==o&&o,a=t.leading,c=void 0!==a&&a,u=s.getState(n);return function(t){var o=function(){var o=s.getState(n);!i&&e(u,o)||(u=o,t(o,s.getActions(r)))};return c&&t(u,s.getActions(r)),s.connections.push(o),{dispose:function(){s.dispose(o)}}}},this.state=o,this.actions=n(i,this.getState,this.getActions,this.setState),this.__IS_COMBINED_STORE__=r,this.__INITIAL_ACTIONS__=i,this.__MIDDLEWARES__=a}return o.prototype.emit=function(){this.connections.forEach(function(t){return t()})},o.prototype.dispose=function(t){this.connections=this.connections.filter(function(e){return e!==t})},o}());var a=function(){return(new Date).getTime()};exports.combineStores=function(t,e){void 0===e&&(e=[]);var n=Object.keys(t),r={},a={},s=[];return Array.isArray(e)&&s.push(e),n.forEach(function(n){t[n]&&(!0===e&&s.push.apply(s,t[n].__MIDDLEWARES__),r[n]=t[n].getState(),a[n]=t[n].__INITIAL_ACTIONS__)}),new i(r,a,o(s))},exports.applyMiddleware=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t},exports.persistState=function(t){if(!t)return null;var e,n=t.key,r=t.interval,o=void 0===r?1e3:r;if(!n)throw new Error("You need to specify a key");var i=function(){n&&localStorage.removeItem(n)};return{set:function(r){if(function(t,e){return t&&t<a()+e}(e,o))return r;e=a();var i={expiryDate:t.expire?(new Date).getTime()+t.expire:null,state:r};return localStorage.setItem(n,JSON.stringify(i)),r},get:function(){var t=JSON.parse(localStorage.getItem(n));if(t){var e=t.state,r=t.expiryDate;if(!r)return e;if(r>a())return e;i()}return{}},purge:i}},exports.logger=function(t,e){var n=e.prevState,r=e.args;return void 0!==typeof window.console&&(console.group("Recieved action: "+e.name),console.info("Arguments: "+r.join[", "]+"."),console.info("Previous state:",n),console.info("Next state:",t),console.groupEnd()),t}; | ||
var t=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t};function e(t,n){return t===n||typeof t==typeof n&&("object"==typeof t?Array.isArray(t)?!!Array.isArray(n)&&(i=e,(r=t).length===(o=n).length&&r.every(function(t,e){return i(t,o[e])})):t instanceof Map?n instanceof Map&&function(t,e,n){if(t.size!==e.size)return!1;var r=[];return t.forEach(function(t,e){r.push(e)}),r.every(function(r){var o=t.get(r),i=e.get(r);return n(o,i)})}(t,n,e):t instanceof Set?n instanceof Set&&function(t,e){if(t.size!==e.size)return!1;var n=[];return t.forEach(function(t){n.push(t)}),n.every(function(t){return e.has(t)})}(t,n):function(t,e,n){var r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;var i={}.hasOwnProperty.bind(e);return r.every(function(r,o){return i(r)&&n(t[r],e[r])})}(t,n,e):t===n);var r,o,i}var n,r,o=function(t){return[].concat.apply([],t)},i=(n=function(e,n,r,o){return Object.keys(e).reduce(function(i,a){return i[a]=Object.keys(e[a]).reduce(function(i,s){var c,u,f;return i[s]=(c=a,u=s,f=e[a][s],function(){for(var e,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];o(((e={})[c]=t({},f(n()[c],r()).apply(void 0,i)),e),{name:c+"."+u,args:i})}),i},{}),i},{})},void 0===(r=!0)&&(r=!1),function(){function o(o,i,a){void 0===o&&(o={}),void 0===i&&(i={}),void 0===a&&(a=[]);var s=this;this.connections=[],this.getActions=function(t){return null===t?{}:t?t(s.actions):s.actions},this.getState=function(t){return null===t?{}:t?t(s.state):s.state},this.setState=function(n,r){void 0===r&&(r={}),void 0===n||e(s.state,n)||(s.middlewares&&s.middlewares.length>0&&(n=s.middlewares.reduce(function(t,e){return e(t,{args:r.args,name:r.name,prevState:s.getState()})},n)),s.state=Array.isArray(s.state)?n.slice():"object"==typeof s.state?t({},s.state,n):n,s.emit())},this.connect=function(t){void 0===t&&(t={});var n=t.mapStateToProps,r=t.mapActionsToProps,o=t.force,i=void 0!==o&&o,a=t.leading,c=void 0!==a&&a,u=s.getState(n);return function(t){var o=function(){var o=s.getState(n);!i&&e(u,o)||(u=o,t(o,s.getActions(r)))};return c&&t(u,s.getActions(r)),s.connections.push(o),{dispose:function(){s.dispose(o)}}}},this.state=o,this.actions=n(i,this.getState,this.getActions,this.setState),this.__IS_COMBINED_STORE__=r,this.__INITIAL_ACTIONS__=i,this.__MIDDLEWARES__=a}return o.prototype.emit=function(){this.connections.forEach(function(t){return t()})},o.prototype.dispose=function(t){this.connections=this.connections.filter(function(e){return e!==t})},o}());var a=function(){return(new Date).getTime()};exports.combineStores=function(t,e){void 0===e&&(e=[]);var n=Object.keys(t),r={},a={},s=[];return Array.isArray(e)&&s.push(e),n.forEach(function(n){t[n]&&(!0===e&&s.push.apply(s,t[n].__MIDDLEWARES__),r[n]=t[n].getState(),a[n]=t[n].__INITIAL_ACTIONS__)}),new i(r,a,o(s))},exports.applyMiddleware=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t},exports.persistState=function(t){if(!t)return null;var e,n=t.key,r=t.interval,o=void 0===r?1e3:r;if(!n)throw new Error("You need to specify a key");var i=function(){n&&localStorage.removeItem(n)};return{set:function(r){if(function(t,e){return t&&t<a()+e}(e,o))return r;e=a();var i={expiryDate:t.expire?(new Date).getTime()+t.expire:null,state:r};return localStorage.setItem(n,JSON.stringify(i)),r},get:function(){var t=JSON.parse(localStorage.getItem(n));if(t){var e=t.state,r=t.expiryDate;if(!r)return e;if(r>a())return e;i()}return{}},purge:i}},exports.logger=function(t,e){var n=e.prevState,r=e.args;return void 0!==typeof window.console&&(console.group("Recieved action: "+e.name),console.info("Arguments: "+r.join[", "]+"."),console.info("Previous state:",n),console.info("Next state:",t),console.groupEnd()),t}; | ||
//# sourceMappingURL=utils.js.map |
53627
734