UNPKG

z-multi-cache

Version:

this is a caching tool that uses localStorage, sessionStorage, memory storage in combination to provide more convenient get data from the cache

230 lines 36.3 kB
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define("zMultiCache",[],o):"object"==typeof exports?exports.zMultiCache=o():e.zMultiCache=o()}(window,function(){return function(e){var o={};function t(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}return t.m=e,t.c=o,t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,o){if(1&o&&(e=t(e)),8&o)return e;if(4&o&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&o&&"string"!=typeof e)for(var r in e)t.d(n,r,function(o){return e[o]}.bind(null,r));return n},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},t.p="",t(t.s="./test/store.js")}({"./node_modules/lodash/_DataView.js": /*!******************************************!*\ !*** ./node_modules/lodash/_DataView.js ***! \******************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_getNative */"./node_modules/lodash/_getNative.js")(t(/*! ./_root */"./node_modules/lodash/_root.js"),"DataView");e.exports=n},"./node_modules/lodash/_Map.js": /*!*************************************!*\ !*** ./node_modules/lodash/_Map.js ***! \*************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_getNative */"./node_modules/lodash/_getNative.js")(t(/*! ./_root */"./node_modules/lodash/_root.js"),"Map");e.exports=n},"./node_modules/lodash/_Promise.js": /*!*****************************************!*\ !*** ./node_modules/lodash/_Promise.js ***! \*****************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_getNative */"./node_modules/lodash/_getNative.js")(t(/*! ./_root */"./node_modules/lodash/_root.js"),"Promise");e.exports=n},"./node_modules/lodash/_Set.js": /*!*************************************!*\ !*** ./node_modules/lodash/_Set.js ***! \*************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_getNative */"./node_modules/lodash/_getNative.js")(t(/*! ./_root */"./node_modules/lodash/_root.js"),"Set");e.exports=n},"./node_modules/lodash/_Symbol.js": /*!****************************************!*\ !*** ./node_modules/lodash/_Symbol.js ***! \****************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_root */"./node_modules/lodash/_root.js").Symbol;e.exports=n},"./node_modules/lodash/_WeakMap.js": /*!*****************************************!*\ !*** ./node_modules/lodash/_WeakMap.js ***! \*****************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_getNative */"./node_modules/lodash/_getNative.js")(t(/*! ./_root */"./node_modules/lodash/_root.js"),"WeakMap");e.exports=n},"./node_modules/lodash/_arrayLikeKeys.js": /*!***********************************************!*\ !*** ./node_modules/lodash/_arrayLikeKeys.js ***! \***********************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_baseTimes */"./node_modules/lodash/_baseTimes.js"),r=t(/*! ./isArguments */"./node_modules/lodash/isArguments.js"),s=t(/*! ./isArray */"./node_modules/lodash/isArray.js"),a=t(/*! ./isBuffer */"./node_modules/lodash/isBuffer.js"),u=t(/*! ./_isIndex */"./node_modules/lodash/_isIndex.js"),c=t(/*! ./isTypedArray */"./node_modules/lodash/isTypedArray.js"),i=Object.prototype.hasOwnProperty;e.exports=function(e,o){var t=s(e),l=!t&&r(e),d=!t&&!l&&a(e),f=!t&&!l&&!d&&c(e),p=t||l||d||f,m=p?n(e.length,String):[],j=m.length;for(var h in e)!o&&!i.call(e,h)||p&&("length"==h||d&&("offset"==h||"parent"==h)||f&&("buffer"==h||"byteLength"==h||"byteOffset"==h)||u(h,j))||m.push(h);return m}},"./node_modules/lodash/_arrayMap.js": /*!******************************************!*\ !*** ./node_modules/lodash/_arrayMap.js ***! \******************************************/ /*! no static exports found */function(e,o){e.exports=function(e,o){for(var t=-1,n=null==e?0:e.length,r=Array(n);++t<n;)r[t]=o(e[t],t,e);return r}},"./node_modules/lodash/_baseGetTag.js": /*!********************************************!*\ !*** ./node_modules/lodash/_baseGetTag.js ***! \********************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_Symbol */"./node_modules/lodash/_Symbol.js"),r=t(/*! ./_getRawTag */"./node_modules/lodash/_getRawTag.js"),s=t(/*! ./_objectToString */"./node_modules/lodash/_objectToString.js"),a="[object Null]",u="[object Undefined]",c=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?u:a:c&&c in Object(e)?r(e):s(e)}},"./node_modules/lodash/_baseIsArguments.js": /*!*************************************************!*\ !*** ./node_modules/lodash/_baseIsArguments.js ***! \*************************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_baseGetTag */"./node_modules/lodash/_baseGetTag.js"),r=t(/*! ./isObjectLike */"./node_modules/lodash/isObjectLike.js"),s="[object Arguments]";e.exports=function(e){return r(e)&&n(e)==s}},"./node_modules/lodash/_baseIsNative.js": /*!**********************************************!*\ !*** ./node_modules/lodash/_baseIsNative.js ***! \**********************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./isFunction */"./node_modules/lodash/isFunction.js"),r=t(/*! ./_isMasked */"./node_modules/lodash/_isMasked.js"),s=t(/*! ./isObject */"./node_modules/lodash/isObject.js"),a=t(/*! ./_toSource */"./node_modules/lodash/_toSource.js"),u=/^\[object .+?Constructor\]$/,c=Function.prototype,i=Object.prototype,l=c.toString,d=i.hasOwnProperty,f=RegExp("^"+l.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!s(e)||r(e))&&(n(e)?f:u).test(a(e))}},"./node_modules/lodash/_baseIsTypedArray.js": /*!**************************************************!*\ !*** ./node_modules/lodash/_baseIsTypedArray.js ***! \**************************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_baseGetTag */"./node_modules/lodash/_baseGetTag.js"),r=t(/*! ./isLength */"./node_modules/lodash/isLength.js"),s=t(/*! ./isObjectLike */"./node_modules/lodash/isObjectLike.js"),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return s(e)&&r(e.length)&&!!a[n(e)]}},"./node_modules/lodash/_baseKeys.js": /*!******************************************!*\ !*** ./node_modules/lodash/_baseKeys.js ***! \******************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_isPrototype */"./node_modules/lodash/_isPrototype.js"),r=t(/*! ./_nativeKeys */"./node_modules/lodash/_nativeKeys.js"),s=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return r(e);var o=[];for(var t in Object(e))s.call(e,t)&&"constructor"!=t&&o.push(t);return o}},"./node_modules/lodash/_baseTimes.js": /*!*******************************************!*\ !*** ./node_modules/lodash/_baseTimes.js ***! \*******************************************/ /*! no static exports found */function(e,o){e.exports=function(e,o){for(var t=-1,n=Array(e);++t<e;)n[t]=o(t);return n}},"./node_modules/lodash/_baseToPairs.js": /*!*********************************************!*\ !*** ./node_modules/lodash/_baseToPairs.js ***! \*********************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_arrayMap */"./node_modules/lodash/_arrayMap.js");e.exports=function(e,o){return n(o,function(o){return[o,e[o]]})}},"./node_modules/lodash/_baseUnary.js": /*!*******************************************!*\ !*** ./node_modules/lodash/_baseUnary.js ***! \*******************************************/ /*! no static exports found */function(e,o){e.exports=function(e){return function(o){return e(o)}}},"./node_modules/lodash/_coreJsData.js": /*!********************************************!*\ !*** ./node_modules/lodash/_coreJsData.js ***! \********************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_root */"./node_modules/lodash/_root.js")["__core-js_shared__"];e.exports=n},"./node_modules/lodash/_createToPairs.js": /*!***********************************************!*\ !*** ./node_modules/lodash/_createToPairs.js ***! \***********************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_baseToPairs */"./node_modules/lodash/_baseToPairs.js"),r=t(/*! ./_getTag */"./node_modules/lodash/_getTag.js"),s=t(/*! ./_mapToArray */"./node_modules/lodash/_mapToArray.js"),a=t(/*! ./_setToPairs */"./node_modules/lodash/_setToPairs.js"),u="[object Map]",c="[object Set]";e.exports=function(e){return function(o){var t=r(o);return t==u?s(o):t==c?a(o):n(o,e(o))}}},"./node_modules/lodash/_freeGlobal.js": /*!********************************************!*\ !*** ./node_modules/lodash/_freeGlobal.js ***! \********************************************/ /*! no static exports found */function(e,o,t){(function(o){var t="object"==typeof o&&o&&o.Object===Object&&o;e.exports=t}).call(this,t(/*! ./../webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"))},"./node_modules/lodash/_getNative.js": /*!*******************************************!*\ !*** ./node_modules/lodash/_getNative.js ***! \*******************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_baseIsNative */"./node_modules/lodash/_baseIsNative.js"),r=t(/*! ./_getValue */"./node_modules/lodash/_getValue.js");e.exports=function(e,o){var t=r(e,o);return n(t)?t:void 0}},"./node_modules/lodash/_getRawTag.js": /*!*******************************************!*\ !*** ./node_modules/lodash/_getRawTag.js ***! \*******************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_Symbol */"./node_modules/lodash/_Symbol.js"),r=Object.prototype,s=r.hasOwnProperty,a=r.toString,u=n?n.toStringTag:void 0;e.exports=function(e){var o=s.call(e,u),t=e[u];try{e[u]=void 0;var n=!0}catch(e){}var r=a.call(e);return n&&(o?e[u]=t:delete e[u]),r}},"./node_modules/lodash/_getTag.js": /*!****************************************!*\ !*** ./node_modules/lodash/_getTag.js ***! \****************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_DataView */"./node_modules/lodash/_DataView.js"),r=t(/*! ./_Map */"./node_modules/lodash/_Map.js"),s=t(/*! ./_Promise */"./node_modules/lodash/_Promise.js"),a=t(/*! ./_Set */"./node_modules/lodash/_Set.js"),u=t(/*! ./_WeakMap */"./node_modules/lodash/_WeakMap.js"),c=t(/*! ./_baseGetTag */"./node_modules/lodash/_baseGetTag.js"),i=t(/*! ./_toSource */"./node_modules/lodash/_toSource.js"),l=i(n),d=i(r),f=i(s),p=i(a),m=i(u),j=c;(n&&"[object DataView]"!=j(new n(new ArrayBuffer(1)))||r&&"[object Map]"!=j(new r)||s&&"[object Promise]"!=j(s.resolve())||a&&"[object Set]"!=j(new a)||u&&"[object WeakMap]"!=j(new u))&&(j=function(e){var o=c(e),t="[object Object]"==o?e.constructor:void 0,n=t?i(t):"";if(n)switch(n){case l:return"[object DataView]";case d:return"[object Map]";case f:return"[object Promise]";case p:return"[object Set]";case m:return"[object WeakMap]"}return o}),e.exports=j},"./node_modules/lodash/_getValue.js": /*!******************************************!*\ !*** ./node_modules/lodash/_getValue.js ***! \******************************************/ /*! no static exports found */function(e,o){e.exports=function(e,o){return null==e?void 0:e[o]}},"./node_modules/lodash/_isIndex.js": /*!*****************************************!*\ !*** ./node_modules/lodash/_isIndex.js ***! \*****************************************/ /*! no static exports found */function(e,o){var t=9007199254740991,n=/^(?:0|[1-9]\d*)$/;e.exports=function(e,o){var r=typeof e;return!!(o=null==o?t:o)&&("number"==r||"symbol"!=r&&n.test(e))&&e>-1&&e%1==0&&e<o}},"./node_modules/lodash/_isMasked.js": /*!******************************************!*\ !*** ./node_modules/lodash/_isMasked.js ***! \******************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_coreJsData */"./node_modules/lodash/_coreJsData.js"),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();e.exports=function(e){return!!r&&r in e}},"./node_modules/lodash/_isPrototype.js": /*!*********************************************!*\ !*** ./node_modules/lodash/_isPrototype.js ***! \*********************************************/ /*! no static exports found */function(e,o){var t=Object.prototype;e.exports=function(e){var o=e&&e.constructor;return e===("function"==typeof o&&o.prototype||t)}},"./node_modules/lodash/_mapToArray.js": /*!********************************************!*\ !*** ./node_modules/lodash/_mapToArray.js ***! \********************************************/ /*! no static exports found */function(e,o){e.exports=function(e){var o=-1,t=Array(e.size);return e.forEach(function(e,n){t[++o]=[n,e]}),t}},"./node_modules/lodash/_nativeKeys.js": /*!********************************************!*\ !*** ./node_modules/lodash/_nativeKeys.js ***! \********************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_overArg */"./node_modules/lodash/_overArg.js")(Object.keys,Object);e.exports=n},"./node_modules/lodash/_nodeUtil.js": /*!******************************************!*\ !*** ./node_modules/lodash/_nodeUtil.js ***! \******************************************/ /*! no static exports found */function(e,o,t){(function(e){var n=t(/*! ./_freeGlobal */"./node_modules/lodash/_freeGlobal.js"),r=o&&!o.nodeType&&o,s=r&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===r&&n.process,u=function(){try{var e=s&&s.require&&s.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=u}).call(this,t(/*! ./../webpack/buildin/module.js */"./node_modules/webpack/buildin/module.js")(e))},"./node_modules/lodash/_objectToString.js": /*!************************************************!*\ !*** ./node_modules/lodash/_objectToString.js ***! \************************************************/ /*! no static exports found */function(e,o){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},"./node_modules/lodash/_overArg.js": /*!*****************************************!*\ !*** ./node_modules/lodash/_overArg.js ***! \*****************************************/ /*! no static exports found */function(e,o){e.exports=function(e,o){return function(t){return e(o(t))}}},"./node_modules/lodash/_root.js": /*!**************************************!*\ !*** ./node_modules/lodash/_root.js ***! \**************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_freeGlobal */"./node_modules/lodash/_freeGlobal.js"),r="object"==typeof self&&self&&self.Object===Object&&self,s=n||r||Function("return this")();e.exports=s},"./node_modules/lodash/_setToPairs.js": /*!********************************************!*\ !*** ./node_modules/lodash/_setToPairs.js ***! \********************************************/ /*! no static exports found */function(e,o){e.exports=function(e){var o=-1,t=Array(e.size);return e.forEach(function(e){t[++o]=[e,e]}),t}},"./node_modules/lodash/_toSource.js": /*!******************************************!*\ !*** ./node_modules/lodash/_toSource.js ***! \******************************************/ /*! no static exports found */function(e,o){var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},"./node_modules/lodash/isArguments.js": /*!********************************************!*\ !*** ./node_modules/lodash/isArguments.js ***! \********************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_baseIsArguments */"./node_modules/lodash/_baseIsArguments.js"),r=t(/*! ./isObjectLike */"./node_modules/lodash/isObjectLike.js"),s=Object.prototype,a=s.hasOwnProperty,u=s.propertyIsEnumerable,c=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,"callee")&&!u.call(e,"callee")};e.exports=c},"./node_modules/lodash/isArray.js": /*!****************************************!*\ !*** ./node_modules/lodash/isArray.js ***! \****************************************/ /*! no static exports found */function(e,o){var t=Array.isArray;e.exports=t},"./node_modules/lodash/isArrayLike.js": /*!********************************************!*\ !*** ./node_modules/lodash/isArrayLike.js ***! \********************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./isFunction */"./node_modules/lodash/isFunction.js"),r=t(/*! ./isLength */"./node_modules/lodash/isLength.js");e.exports=function(e){return null!=e&&r(e.length)&&!n(e)}},"./node_modules/lodash/isBuffer.js": /*!*****************************************!*\ !*** ./node_modules/lodash/isBuffer.js ***! \*****************************************/ /*! no static exports found */function(e,o,t){(function(e){var n=t(/*! ./_root */"./node_modules/lodash/_root.js"),r=t(/*! ./stubFalse */"./node_modules/lodash/stubFalse.js"),s=o&&!o.nodeType&&o,a=s&&"object"==typeof e&&e&&!e.nodeType&&e,u=a&&a.exports===s?n.Buffer:void 0,c=(u?u.isBuffer:void 0)||r;e.exports=c}).call(this,t(/*! ./../webpack/buildin/module.js */"./node_modules/webpack/buildin/module.js")(e))},"./node_modules/lodash/isFunction.js": /*!*******************************************!*\ !*** ./node_modules/lodash/isFunction.js ***! \*******************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_baseGetTag */"./node_modules/lodash/_baseGetTag.js"),r=t(/*! ./isObject */"./node_modules/lodash/isObject.js"),s="[object AsyncFunction]",a="[object Function]",u="[object GeneratorFunction]",c="[object Proxy]";e.exports=function(e){if(!r(e))return!1;var o=n(e);return o==a||o==u||o==s||o==c}},"./node_modules/lodash/isLength.js": /*!*****************************************!*\ !*** ./node_modules/lodash/isLength.js ***! \*****************************************/ /*! no static exports found */function(e,o){var t=9007199254740991;e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=t}},"./node_modules/lodash/isObject.js": /*!*****************************************!*\ !*** ./node_modules/lodash/isObject.js ***! \*****************************************/ /*! no static exports found */function(e,o){e.exports=function(e){var o=typeof e;return null!=e&&("object"==o||"function"==o)}},"./node_modules/lodash/isObjectLike.js": /*!*********************************************!*\ !*** ./node_modules/lodash/isObjectLike.js ***! \*********************************************/ /*! no static exports found */function(e,o){e.exports=function(e){return null!=e&&"object"==typeof e}},"./node_modules/lodash/isTypedArray.js": /*!*********************************************!*\ !*** ./node_modules/lodash/isTypedArray.js ***! \*********************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_baseIsTypedArray */"./node_modules/lodash/_baseIsTypedArray.js"),r=t(/*! ./_baseUnary */"./node_modules/lodash/_baseUnary.js"),s=t(/*! ./_nodeUtil */"./node_modules/lodash/_nodeUtil.js"),a=s&&s.isTypedArray,u=a?r(a):n;e.exports=u},"./node_modules/lodash/keys.js": /*!*************************************!*\ !*** ./node_modules/lodash/keys.js ***! \*************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_arrayLikeKeys */"./node_modules/lodash/_arrayLikeKeys.js"),r=t(/*! ./_baseKeys */"./node_modules/lodash/_baseKeys.js"),s=t(/*! ./isArrayLike */"./node_modules/lodash/isArrayLike.js");e.exports=function(e){return s(e)?n(e):r(e)}},"./node_modules/lodash/stubFalse.js": /*!******************************************!*\ !*** ./node_modules/lodash/stubFalse.js ***! \******************************************/ /*! no static exports found */function(e,o){e.exports=function(){return!1}},"./node_modules/lodash/toPairs.js": /*!****************************************!*\ !*** ./node_modules/lodash/toPairs.js ***! \****************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! ./_createToPairs */"./node_modules/lodash/_createToPairs.js")(t(/*! ./keys */"./node_modules/lodash/keys.js"));e.exports=n},"./node_modules/query-parse/index.js": /*!*******************************************!*\ !*** ./node_modules/query-parse/index.js ***! \*******************************************/ /*! no static exports found */function(e,o,t){var n=t(/*! querystring */"./node_modules/querystring-es3/index.js"),r=t(/*! lodash/toPairs */"./node_modules/lodash/toPairs.js"),s={toString:function(e){var o="";return r(e).sort().map(function(e){void 0!==e[1]&&(""!==o&&(o+="&"),o+=e[0]+"="+encodeURIComponent(e[1]))}),o},toObject:function(e){return n.parse(e)}};e.exports=s},"./node_modules/querystring-es3/decode.js": /*!************************************************!*\ !*** ./node_modules/querystring-es3/decode.js ***! \************************************************/ /*! no static exports found */function(e,o,t){"use strict";function n(e,o){return Object.prototype.hasOwnProperty.call(e,o)}e.exports=function(e,o,t,s){o=o||"&",t=t||"=";var a={};if("string"!=typeof e||0===e.length)return a;var u=/\+/g;e=e.split(o);var c=1e3;s&&"number"==typeof s.maxKeys&&(c=s.maxKeys);var i=e.length;c>0&&i>c&&(i=c);for(var l=0;l<i;++l){var d,f,p,m,j=e[l].replace(u,"%20"),h=j.indexOf(t);h>=0?(d=j.substr(0,h),f=j.substr(h+1)):(d=j,f=""),p=decodeURIComponent(d),m=decodeURIComponent(f),n(a,p)?r(a[p])?a[p].push(m):a[p]=[a[p],m]:a[p]=m}return a};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},"./node_modules/querystring-es3/encode.js": /*!************************************************!*\ !*** ./node_modules/querystring-es3/encode.js ***! \************************************************/ /*! no static exports found */function(e,o,t){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,o,t,u){return o=o||"&",t=t||"=",null===e&&(e=void 0),"object"==typeof e?s(a(e),function(a){var u=encodeURIComponent(n(a))+t;return r(e[a])?s(e[a],function(e){return u+encodeURIComponent(n(e))}).join(o):u+encodeURIComponent(n(e[a]))}).join(o):u?encodeURIComponent(n(u))+t+encodeURIComponent(n(e)):""};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function s(e,o){if(e.map)return e.map(o);for(var t=[],n=0;n<e.length;n++)t.push(o(e[n],n));return t}var a=Object.keys||function(e){var o=[];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.push(t);return o}},"./node_modules/querystring-es3/index.js": /*!***********************************************!*\ !*** ./node_modules/querystring-es3/index.js ***! \***********************************************/ /*! no static exports found */function(e,o,t){"use strict";o.decode=o.parse=t(/*! ./decode */"./node_modules/querystring-es3/decode.js"),o.encode=o.stringify=t(/*! ./encode */"./node_modules/querystring-es3/encode.js")},"./node_modules/webpack/buildin/global.js": /*!***********************************!*\ !*** (webpack)/buildin/global.js ***! \***********************************/ /*! no static exports found */function(e,o){var t;t=function(){return this}();try{t=t||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(t=window)}e.exports=t},"./node_modules/webpack/buildin/module.js": /*!***********************************!*\ !*** (webpack)/buildin/module.js ***! \***********************************/ /*! no static exports found */function(e,o){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},"./src/storages/index.js": /*!*******************************!*\ !*** ./src/storages/index.js ***! \*******************************/ /*! exports provided: originStorageMap, setItemStoragesList, setItemStoragesMap, setItemStoragesListStr, getItemStoragesList, getItemStoragesMap, getItemStoragesListStr, Storage, default */function(e,o,t){"use strict";t.r(o),t.d(o,"originStorageMap",function(){return s}),t.d(o,"setItemStoragesList",function(){return a}),t.d(o,"setItemStoragesMap",function(){return u}),t.d(o,"setItemStoragesListStr",function(){return c}),t.d(o,"getItemStoragesList",function(){return i}),t.d(o,"getItemStoragesMap",function(){return l}),t.d(o,"getItemStoragesListStr",function(){return d}),t.d(o,"Storage",function(){return j});var n=t(/*! ./memoryStorage */"./src/storages/memoryStorage.js");function r(e,o){for(var t=0;t<o.length;t++){var n=o[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s={localStorage:localStorage,sessionStorage:sessionStorage,memoryStorage:n.default},a=Object.keys(s),u=a.reduce(function(e,o){return e[o]=o,e},{}),c=a.join(", "),i=a.concat("urlSearch"),l=i.reduce(function(e,o){return e[o]=o,e},{}),d=i.join(", ");function f(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"setItem";if("setItem"!==o&&"getItem"!==o)throw new Error("method need to be one of setItem, getItem");if("setItem"===o){if(!u[e])throw new Error("[setItem]: type should be one of: ".concat(c,", your value is: ").concat(e))}else if(!l[e])throw new Error("[getItem]: type should be one of: ".concat(d,", your value is: ").concat(e))}function p(e,o){f(e,"getItem");var t=s[e].getItem(o);return JSON.parse(t)||{}}function m(e,o,t,n){f(e);try{var r=JSON.stringify(t);s[e].setItem(o,r)}catch(e){n&&n(e)}}var j=function(){function e(){!function(e,o){if(!(e instanceof o))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,o,t){o&&r(e.prototype,o),t&&r(e,t)}(e,[{key:"setItem",value:function(e,o,t,n,r){var s=p(e,o);s[t]=n,m(e,o,s,r)}},{key:"getItem",value:function(e,o,t){return p(e,o)[t]}},{key:"removeItem",value:function(e,o,t){delete p(e,o)[t],m(e,o,t)}},{key:"clear",value:function(e,o){m(e,o,{})}}]),e}(),h=new j;o.default=h},"./src/storages/memoryStorage.js": /*!***************************************!*\ !*** ./src/storages/memoryStorage.js ***! \***************************************/ /*! exports provided: MemoryStorage, default */function(e,o,t){"use strict";function n(e,o){for(var t=0;t<o.length;t++){var n=o[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}t.r(o),t.d(o,"MemoryStorage",function(){return r});var r=function(){function e(){!function(e,o){if(!(e instanceof o))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,o,t){o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t}(this,"storage",{})}return function(e,o,t){o&&n(e.prototype,o),t&&n(e,t)}(e,[{key:"setItem",value:function(e,o){this.storage[e]=String(o)}},{key:"getItem",value:function(e){return this.storage[e]||null}},{key:"removeItem",value:function(e){delete this.storage[e]}},{key:"clear",value:function(){this.storage={}}}]),e}(),s=new r;o.default=s},"./src/store.js": /*!**********************!*\ !*** ./src/store.js ***! \**********************/ /*! exports provided: factory, default */function(e,o,t){"use strict";t.r(o),t.d(o,"factory",function(){return y});var n=t(/*! @storages/index */"./src/storages/index.js"),r=t(/*! ./utils */"./src/utils.js");function s(e){for(var o=1;o<arguments.length;o++){var t=null!=arguments[o]?arguments[o]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(o){a(e,o,t[o])})}return e}function a(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}var u="$zMultiCachePrefix$",c="$page$",i="sessionStorage",l=function(){};function d(e){return Object.prototype.toString.call(e).slice(8,-1).toLocaleLowerCase()}function f(e){return"object"===d(e)}function p(e,o,t,n){if(e)if(j(t)){var r=o.globalKeys;if("array"!==d(r))throw new Error("globalKeys need to be an array.");if(!r.some(function(e){return e===n}))throw new Error('key "'.concat(n,'" should be defined in globalKeys firstly.'))}else{var s=o.pages;if("array"!==d(s))throw new Error("pages need to be an array.");if(!s.some(function(e){return e===t}))throw new Error('the page part of scope "'.concat(t,'" should be defined in pages firstly.'))}}function m(e){var o=e.type,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"setItem";if("setItem"!==t&&"getItem"!==t)throw new Error("method need to be one of setItem, getItem");if("setItem"===t){if(!n.setItemStoragesMap[o])throw new Error("[setItem]: type should be one of: ".concat(n.setItemStoragesListStr,", your value is: ").concat(o))}else if(!n.getItemStoragesMap[o])throw new Error("[getItem]: type should be one of: ".concat(n.getItemStoragesListStr,", your value is: ").concat(o))}function j(e){return"global"===e}function h(e,o,t){if("string"!=typeof e)throw new Error("scope need to be a string.");var n=(e=e.replace(/\s*\/?\s*$/g,"")).indexOf(t),r=-1!==n,s=e.slice(0,r?n:void 0).trim(),a=e.substr(r?n+t.length:e.length).trim();a=a.length?"".concat(a,">"):"".concat(a);var u=j(s)?"".concat(o):"".concat(a).concat(o);return{page:s||void 0,itemKey:u}}function y(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=e.ns,t=void 0===o?"$ns$":o,j=e.strict,y=void 0!==j&&j,b=e.template,g=void 0===b?{}:b,_=e.scopeSeparator,v=void 0===_?"/":_,S=e.getterStrict,w=void 0===S||S;if(y&&!f(g))throw new Error('when "strict" is true, template is needed. template is a simple object.');var x="".concat(u,"-").concat(t);return{setItem:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=t.type,u=void 0===s?i:s,d=t.scope,f=void 0===d?"global":d,j=t.errCallBack,b=void 0===j?l:j,_=t.updateUrlSearchKey,S=t.updateUrlSearchKeyTime;m({type:u});var w=h(f,e,v),O=w.page,I=void 0===O?c:O,P=w.itemKey;p(y,g,I,P);var k="".concat(x,"-").concat(I);n.default.setItem(u,k,P,o,b),_&&Object(r.updateUrlSearchPart)(a({},_,o),S,"")},getItem:function(){var e,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=t.type,l=void 0===u?i:u,j=t.scope,b=void 0===j?"global":j,_=t.updateUrlSearchKey,S=t.updateUrlSearchKeyTime,O=t.default;if(O=function(e){return"function"==typeof e?e():e}(O),"array"===d(l)){for(var I=0,P=l.length;I<P;I++){var k=this.getItem(o,s({},t,{type:l[I],default:void 0}));if(k)return k}return O}if(f(l)&&(o=l.key||o,l=l.type),m({type:l},"getItem"),"urlSearch"===l){e=Object(r.getUrlParam)(o)||O}else{var A=h(b,o,v),T=A.page,M=void 0===T?c:T,U=A.itemKey;w&&p(y,g,M,U);var E="".concat(x,"-").concat(M),K=n.default.getItem(l,E,U);e=void 0===K||null===K?O:K}return _&&Object(r.updateUrlSearchPart)(a({},_,e),S,""),e},removeItem:function(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=o.type,r=void 0===t?i:t,s=o.scope,a=void 0===s?"global":s;m({type:r});var u=h(a,e,v),l=u.page,d=void 0===l?c:l,f=u.itemKey;p(y,g,d,f);var j="".concat(x,"-").concat(d);n.default.removeItem(r,j,f)},clear:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=e.type,t=void 0===o?i:o,r=e.scope,s=void 0===r?"global":r;m({type:t});var a=h(s,"",v),u=a.page,l=void 0===u?c:u,d=a.itemKey;p(y,g,l,d);var f="".concat(x,"-").concat(l);n.default.clear(t,f)},clearAll:function(){var e=this,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"sessionStorage";if("array"!==d(o)){if(!n.setItemStoragesMap[o])throw new Error("type should be one of: ".concat(n.setItemStoragesListStr,", your value is: ").concat(o));if(y)(g.pages||[]).concat("global").forEach(function(e){var t="".concat(x,"-").concat(e);n.originStorageMap[o].removeItem(t)});else Object.keys(n.originStorageMap[o]).forEach(function(e){e.indexOf(x)>-1&&n.originStorageMap[o].removeItem(e)})}else o.forEach(function(o){e.clearAll(o)})},types:n.getItemStoragesMap,updateUrlSearch:function(){var e=this,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,s={};Object.keys(o).forEach(function(t){var n=o[t];"array"===d(n)?s[t]=e.getItem(n[0],n[1]):s[t]=n}),Object(r.updateUrlSearchPart)(s,t,n)},updateUrlSearchByValue:r.updateUrlSearchPart,getUrlParam:r.getUrlParam}}var b=y();o.default=b},"./src/utils.js": /*!**********************!*\ !*** ./src/utils.js ***! \**********************/ /*! exports provided: getUrlParam, updateUrlSearchPart */function(e,o,t){"use strict";t.r(o),t.d(o,"getUrlParam",function(){return a}),t.d(o,"updateUrlSearchPart",function(){return u});var n=t(/*! query-parse */"./node_modules/query-parse/index.js"),r=t.n(n);function s(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}function a(e){var o=window.location.search,t=r.a.toObject(o.replace(/^\?/,""));return e?t[e]:t}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0;"number"==typeof o?setTimeout(function(){c(e,t)},o):c(e,t)}function c(e,o){var t=window.location,n=t.href,u=t.search,c=a();if(Object.keys(c).length){var i=function(e){for(var o=1;o<arguments.length;o++){var t=null!=arguments[o]?arguments[o]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(o){s(e,o,t[o])})}return e}({},c,e),l="?"+r.a.toString(i);if(u!==l){var d=n.replace(u,l),f=void 0===o?document.title:o;window.history.replaceState(null,f,d)}}}},"./test/store.js": /*!***********************!*\ !*** ./test/store.js ***! \***********************/ /*! no exports provided */function(e,o,t){"use strict";t.r(o);var n=t(/*! @src/store */"./src/store.js"),r=Object(n.factory)({ns:"tmc",strict:!0,template:{globalKeys:["age"],pages:["home"]}});console.log("start..."),r.setItem("name",100,{scope:"home"}),r.setItem("age",18,{scope:"global",type:"localStorage",updateUrlSearchKey:"xixixi",updateUrlSearchKeyTime:2e3});r.getItem("timsssss",{scope:"home",type:["localStorage",{key:"xixi",type:"urlSearch"}],updateUrlSearchKey:"happy"});r.updateUrlSearch({name:["name",{scope:"home"}],age:["age",{scope:"global",type:"localStorage"}],arrDate:["hotelArrDate",{scope:"home/hotel",type:[],default:0}]}),setTimeout(function(){r.clearAll(["localStorage"])},1e3)}})}); //# sourceMappingURL=store.js.map