mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
1 line
5.9 KiB
JSON
1 line
5.9 KiB
JSON
|
{"ast":null,"code":"import MapCache from './_MapCache.js';\n/** Error message constants. */\n\nvar FUNC_ERROR_TEXT = 'Expected a function';\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\n\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || resolver != null && typeof resolver != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n\n var memoized = function () {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n\n memoized.cache = new (memoize.Cache || MapCache)();\n return memoized;\n} // Expose `MapCache`.\n\n\nmemoize.Cache = MapCache;\nexport default memoize;","map":{"version":3,"sources":["/app/node_modules/lodash-es/memoize.js"],"names":["MapCache","FUNC_ERROR_TEXT","memoize","func","resolver","TypeError","memoized","args","arguments","key","apply","cache","has","get","result","set","Cache"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gBAArB;AAEA;;AACA,IAAIC,eAAe,GAAG,qBAAtB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,OAAT,CAAiBC,IAAjB,EAAuBC,QAAvB,EAAiC;AAC/B,MAAI,OAAOD,IAAP,IAAe,UAAf,IAA8BC,QAAQ,IAAI,IAAZ,IAAoB,OAAOA,QAAP,IAAmB,UAAzE,EAAsF;AACpF,UAAM,IAAIC,SAAJ,CAAcJ,eAAd,CAAN;AACD;;AACD,MAAIK,QAAQ,GAAG,YAAW;AACxB,QAAIC,IAAI,GAAGC,SAAX;AAAA,QACIC,GAAG,GAAGL,QAAQ,GAAGA,QAAQ,CAACM,KAAT,CAAe,IAAf,EAAqBH,IAArB,CAAH,GAAgCA,IAAI,CAAC,CAAD,CADtD;AAAA,QAEII,KAAK,GAAGL,QAAQ,CAACK,KAFrB;;AAIA,QAAIA,KAAK,CAACC,GAAN,CAAUH,GAAV,CAAJ,EAAoB;AAClB,aAAOE,KAAK,CAACE,GAAN,CAAUJ,GAAV,CAAP;AACD;;AACD,QAAIK,MAAM,GAAGX,IAAI,CAACO,KAAL,CAAW,IAAX,EAAiBH,IAAjB,CAAb;AACAD,IAAAA,QAAQ,CAACK,KAAT,GAAiBA,KAAK,CAACI,GAAN,CAAUN,GAAV,EAAeK,MAAf,KAA0BH,KAA3C;AACA,WAAOG,MAAP;AACD,GAXD;;AAYAR,EAAAA,QAAQ,CAACK,KAAT,GAAiB,KAAKT,OAAO,CAACc,KAAR,IAAiBhB,QAAtB,GAAjB;AACA,SAAOM,QAAP;AACD,C,CAED;;;AACAJ,OAAO,CAACc,KAAR,GAAgBhB,QAAhB;AAEA,eAAeE,OAAf","sourcesContent":["import MapCache from './_MapCache.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is us
|