3 lines
2.8 KiB
JavaScript
3 lines
2.8 KiB
JavaScript
|
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e||self).createPersistedState=r()}(this,function(){var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===r}(e)}(e)},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function t(e,r){return!1!==r.clone&&r.isMergeableObject(e)?u(Array.isArray(e)?[]:{},e,r):e}function n(e,r,n){return e.concat(r).map(function(e){return t(e,n)})}function o(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(r){return e.propertyIsEnumerable(r)}):[]}(e))}function c(e,r){try{return r in e}catch(e){return!1}}function u(r,i,a){(a=a||{}).arrayMerge=a.arrayMerge||n,a.isMergeableObject=a.isMergeableObject||e,a.cloneUnlessOtherwiseSpecified=t;var f=Array.isArray(i);return f===Array.isArray(r)?f?a.arrayMerge(r,i,a):function(e,r,n){var i={};return n.isMergeableObject(e)&&o(e).forEach(function(r){i[r]=t(e[r],n)}),o(r).forEach(function(o){(function(e,r){return c(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))})(e,o)||(i[o]=c(e,o)&&n.isMergeableObject(r[o])?function(e,r){if(!r.customMerge)return u;var t=r.customMerge(e);return"function"==typeof t?t:u}(o,n)(e[o],r[o],n):t(r[o],n))}),i}(r,i,a):t(i,a)}u.all=function(e,r){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,t){return u(e,t,r)},{})};var i=u;return function(e){var r=(e=e||{}).storage||window&&window.localStorage,t=e.key||"vuex";function n(e,r){var t=r.getItem(e);try{return"string"==typeof t?JSON.parse(t):"object"==typeof t?t:void 0}catch(e){}}function o(){return!0}function c(e,r,t){return t.setItem(e,JSON.stringify(r))}function u(e,r){return Array.isArray(r)?r.reduce(function(r,t){return function(e,r,t,n){return!/^(__proto__|constructor|prototype)$/.test(r)&&((r=r.split?r.split("."):r.slice(0)).slice(0,-1).reduce(function(e,r){return e[r]=e[r]||{}},e)[r.pop()]=t),e}(r,t,(n=e,void 0===(n=((o=t).split?o.split("."):o).reduce(function(e,r){return e&&e[r]},n))?void 0:n));var n,o},{}):e}function a(e){return function(r){return e.subscribe(r)}}(e.assertStorage||function(){r.setItem("@@",1),r.removeItem("@@")})(r);var f,s=function(){return(e.getState||n)(t,r)};return e.fetchBeforeUse&&(f=s()),function(n){e.fetchBeforeUse||(f=s()),"object"==typeof f&&null!==f&&(n.replaceState(e.overwrite?f:i(n.state,f,{arrayMerge:e.arrayMerger||function(e,r){return r},clone:!1})),(e.rehydrated||function(){})(n)),(e.subscriber||a)(n)(function(n,i){(e.filter||o)(n)&&(e.setState||c)(t,(e.reducer||u)(i,e.paths),r)})}}});
|
||
|
//# sourceMappingURL=vuex-persistedstate.umd.js.map
|