9c6a78fe64aff82ebbc1c21f4c366682.json
13 KB
{"ast":null,"code":"var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");Object.defineProperty(exports,\"__esModule\",{value:true});exports.default=void 0;var _deepAssign=_interopRequireDefault(require(\"deep-assign\"));var mergeLocalStorageItem=function mergeLocalStorageItem(key,value){var oldValue=window.localStorage.getItem(key);var oldObject=JSON.parse(oldValue);var newObject=JSON.parse(value);var nextValue=JSON.stringify((0,_deepAssign.default)({},oldObject,newObject));window.localStorage.setItem(key,nextValue);};var createPromise=function createPromise(getValue,callback){return new Promise(function(resolve,reject){try{var value=getValue();if(callback){callback(null,value);}resolve(value);}catch(err){if(callback){callback(err);}reject(err);}});};var createPromiseAll=function createPromiseAll(promises,callback,processResult){return Promise.all(promises).then(function(result){var value=processResult?processResult(result):null;callback&&callback(null,value);return Promise.resolve(value);},function(errors){callback&&callback(errors);return Promise.reject(errors);});};var AsyncStorage=function(){function AsyncStorage(){}AsyncStorage.clear=function clear(callback){return createPromise(function(){window.localStorage.clear();},callback);};AsyncStorage.flushGetRequests=function flushGetRequests(){};AsyncStorage.getAllKeys=function getAllKeys(callback){return createPromise(function(){var numberOfKeys=window.localStorage.length;var keys=[];for(var i=0;i<numberOfKeys;i+=1){var key=window.localStorage.key(i);keys.push(key);}return keys;},callback);};AsyncStorage.getItem=function getItem(key,callback){return createPromise(function(){return window.localStorage.getItem(key);},callback);};AsyncStorage.multiGet=function multiGet(keys,callback){var promises=keys.map(function(key){return AsyncStorage.getItem(key);});var processResult=function processResult(result){return result.map(function(value,i){return[keys[i],value];});};return createPromiseAll(promises,callback,processResult);};AsyncStorage.setItem=function setItem(key,value,callback){return createPromise(function(){window.localStorage.setItem(key,value);},callback);};AsyncStorage.multiSet=function multiSet(keyValuePairs,callback){var promises=keyValuePairs.map(function(item){return AsyncStorage.setItem(item[0],item[1]);});return createPromiseAll(promises,callback);};AsyncStorage.mergeItem=function mergeItem(key,value,callback){return createPromise(function(){mergeLocalStorageItem(key,value);},callback);};AsyncStorage.multiMerge=function multiMerge(keyValuePairs,callback){var promises=keyValuePairs.map(function(item){return AsyncStorage.mergeItem(item[0],item[1]);});return createPromiseAll(promises,callback);};AsyncStorage.removeItem=function removeItem(key,callback){return createPromise(function(){return window.localStorage.removeItem(key);},callback);};AsyncStorage.multiRemove=function multiRemove(keys,callback){var promises=keys.map(function(key){return AsyncStorage.removeItem(key);});return createPromiseAll(promises,callback);};return AsyncStorage;}();exports.default=AsyncStorage;","map":{"version":3,"sources":["C:/Users/bluej/Desktop/2_2/searchGuide/searchGuide/node_modules/react-native-web/dist/exports/AsyncStorage/index.js"],"names":["mergeLocalStorageItem","key","value","oldValue","window","localStorage","getItem","oldObject","JSON","parse","newObject","nextValue","stringify","setItem","createPromise","getValue","callback","Promise","resolve","reject","err","createPromiseAll","promises","processResult","all","then","result","errors","AsyncStorage","clear","flushGetRequests","getAllKeys","numberOfKeys","length","keys","i","push","multiGet","map","multiSet","keyValuePairs","item","mergeItem","multiMerge","removeItem","multiRemove"],"mappings":"mKASA,+DAEA,GAAIA,CAAAA,qBAAqB,CAAG,QAASA,CAAAA,qBAAT,CAA+BC,GAA/B,CAAoCC,KAApC,CAA2C,CACrE,GAAIC,CAAAA,QAAQ,CAAGC,MAAM,CAACC,YAAP,CAAoBC,OAApB,CAA4BL,GAA5B,CAAf,CACA,GAAIM,CAAAA,SAAS,CAAGC,IAAI,CAACC,KAAL,CAAWN,QAAX,CAAhB,CACA,GAAIO,CAAAA,SAAS,CAAGF,IAAI,CAACC,KAAL,CAAWP,KAAX,CAAhB,CACA,GAAIS,CAAAA,SAAS,CAAGH,IAAI,CAACI,SAAL,CAAe,wBAAM,EAAN,CAAUL,SAAV,CAAqBG,SAArB,CAAf,CAAhB,CACAN,MAAM,CAACC,YAAP,CAAoBQ,OAApB,CAA4BZ,GAA5B,CAAiCU,SAAjC,EACD,CAND,CAQA,GAAIG,CAAAA,aAAa,CAAG,QAASA,CAAAA,aAAT,CAAuBC,QA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,aAApB,CAAmCxB,QAAnC,CAA6C,CACrE,GAAIM,CAAAA,QAAQ,CAAGkB,aAAa,CAACF,GAAd,CAAkB,SAAUG,IAAV,CAAgB,CAC/C,MAAOb,CAAAA,YAAY,CAACc,SAAb,CAAuBD,IAAI,CAAC,CAAD,CAA3B,CAAgCA,IAAI,CAAC,CAAD,CAApC,CAAP,CACD,CAFc,CAAf,CAGA,MAAOpB,CAAAA,gBAAgB,CAACC,QAAD,CAAWN,QAAX,CAAvB,CACD,CALD,CAWAY,YAAY,CAACgB,UAAb,CAA0B,QAASA,CAAAA,UAAT,CAAoB3C,GAApB,CAAyBe,QAAzB,CAAmC,CAC3D,MAAOF,CAAAA,aAAa,CAAC,UAAY,CAC/B,MAAOV,CAAAA,MAAM,CAACC,YAAP,CAAoBuC,UAApB,CAA+B3C,GAA/B,CAAP,CACD,CAFmB,CAEjBe,QAFiB,CAApB,CAGD,CAJD,CAUAY,YAAY,CAACiB,WAAb,CAA2B,QAASA,CAAAA,WAAT,CAAqBX,IAArB,CAA2BlB,QAA3B,CAAqC,CAC9D,GAAIM,CAAAA,QAAQ,CAAGY,IAAI,CAACI,GAAL,CAAS,SAAUrC,GAAV,CAAe,CACrC,MAAO2B,CAAAA,YAAY,CAACgB,UAAb,CAAwB3C,GAAxB,CAAP,CACD,CAFc,CAAf,CAGA,MAAOoB,CAAAA,gBAAgB,CAACC,QAAD,CAAWN,QAAX,CAAvB,CACD,CALD,CAOA,MAAOY,CAAAA,YAAP,CACD,CAvID,EAFA,C","sourcesContent":["/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\nimport merge from 'deep-assign';\n\nvar mergeLocalStorageItem = function mergeLocalStorageItem(key, value) {\n var oldValue = window.localStorage.getItem(key);\n var oldObject = JSON.parse(oldValue);\n var newObject = JSON.parse(value);\n var nextValue = JSON.stringify(merge({}, oldObject, newObject));\n window.localStorage.setItem(key, nextValue);\n};\n\nvar createPromise = function createPromise(getValue, callback) {\n return new Promise(function (resolve, reject) {\n try {\n var value = getValue();\n\n if (callback) {\n callback(null, value);\n }\n\n resolve(value);\n } catch (err) {\n if (callback) {\n callback(err);\n }\n\n reject(err);\n }\n });\n};\n\nvar createPromiseAll = function createPromiseAll(promises, callback, processResult) {\n return Promise.all(promises).then(function (result) {\n var value = processResult ? processResult(result) : null;\n callback && callback(null, value);\n return Promise.resolve(value);\n }, function (errors) {\n callback && callback(errors);\n return Promise.reject(errors);\n });\n};\n\nvar AsyncStorage =\n/*#__PURE__*/\nfunction () {\n function AsyncStorage() {}\n\n /**\n * Erases *all* AsyncStorage for the domain.\n */\n AsyncStorage.clear = function clear(callback) {\n return createPromise(function () {\n window.localStorage.clear();\n }, callback);\n }\n /**\n * (stub) Flushes any pending requests using a single batch call to get the data.\n */\n ;\n\n AsyncStorage.flushGetRequests = function flushGetRequests() {}\n /**\n * Gets *all* keys known to the app, for all callers, libraries, etc.\n */\n ;\n\n AsyncStorage.getAllKeys = function getAllKeys(callback) {\n return createPromise(function () {\n var numberOfKeys = window.localStorage.length;\n var keys = [];\n\n for (var i = 0; i < numberOfKeys; i += 1) {\n var key = window.localStorage.key(i);\n keys.push(key);\n }\n\n return keys;\n }, callback);\n }\n /**\n * Fetches `key` value.\n */\n ;\n\n AsyncStorage.getItem = function getItem(key, callback) {\n return createPromise(function () {\n return window.localStorage.getItem(key);\n }, callback);\n }\n /**\n * multiGet resolves to an array of key-value pair arrays that matches the\n * input format of multiSet.\n *\n * multiGet(['k1', 'k2']) -> [['k1', 'val1'], ['k2', 'val2']]\n */\n ;\n\n AsyncStorage.multiGet = function multiGet(keys, callback) {\n var promises = keys.map(function (key) {\n return AsyncStorage.getItem(key);\n });\n\n var processResult = function processResult(result) {\n return result.map(function (value, i) {\n return [keys[i], value];\n });\n };\n\n return createPromiseAll(promises, callback, processResult);\n }\n /**\n * Sets `value` for `key`.\n */\n ;\n\n AsyncStorage.setItem = function setItem(key, value, callback) {\n return createPromise(function () {\n window.localStorage.setItem(key, value);\n }, callback);\n }\n /**\n * Takes an array of key-value array pairs.\n * multiSet([['k1', 'val1'], ['k2', 'val2']])\n */\n ;\n\n AsyncStorage.multiSet = function multiSet(keyValuePairs, callback) {\n var promises = keyValuePairs.map(function (item) {\n return AsyncStorage.setItem(item[0], item[1]);\n });\n return createPromiseAll(promises, callback);\n }\n /**\n * Merges existing value with input value, assuming they are stringified JSON.\n */\n ;\n\n AsyncStorage.mergeItem = function mergeItem(key, value, callback) {\n return createPromise(function () {\n mergeLocalStorageItem(key, value);\n }, callback);\n }\n /**\n * Takes an array of key-value array pairs and merges them with existing\n * values, assuming they are stringified JSON.\n *\n * multiMerge([['k1', 'val1'], ['k2', 'val2']])\n */\n ;\n\n AsyncStorage.multiMerge = function multiMerge(keyValuePairs, callback) {\n var promises = keyValuePairs.map(function (item) {\n return AsyncStorage.mergeItem(item[0], item[1]);\n });\n return createPromiseAll(promises, callback);\n }\n /**\n * Removes a `key`\n */\n ;\n\n AsyncStorage.removeItem = function removeItem(key, callback) {\n return createPromise(function () {\n return window.localStorage.removeItem(key);\n }, callback);\n }\n /**\n * Delete all the keys in the `keys` array.\n */\n ;\n\n AsyncStorage.multiRemove = function multiRemove(keys, callback) {\n var promises = keys.map(function (key) {\n return AsyncStorage.removeItem(key);\n });\n return createPromiseAll(promises, callback);\n };\n\n return AsyncStorage;\n}();\n\nexport { AsyncStorage as default };"]},"metadata":{},"sourceType":"script"}