From e99f950f5018cfe737c0d1150e50d97c6e6a4823 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 1 Nov 2023 20:49:36 +0800 Subject: update --- node_modules/webpack/lib/util/memoize.js | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 node_modules/webpack/lib/util/memoize.js (limited to 'node_modules/webpack/lib/util/memoize.js') diff --git a/node_modules/webpack/lib/util/memoize.js b/node_modules/webpack/lib/util/memoize.js deleted file mode 100644 index 5a73ee75..00000000 --- a/node_modules/webpack/lib/util/memoize.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php -*/ - -"use strict"; - -/** @template T @typedef {function(): T} FunctionReturning */ - -/** - * @template T - * @param {FunctionReturning} fn memorized function - * @returns {FunctionReturning} new function - */ -const memoize = fn => { - let cache = false; - /** @type {T | undefined} */ - let result = undefined; - return () => { - if (cache) { - return /** @type {T} */ (result); - } else { - result = fn(); - cache = true; - // Allow to clean up memory for fn - // and all dependent resources - fn = undefined; - return /** @type {T} */ (result); - } - }; -}; - -module.exports = memoize; -- cgit v1.2.3