css finally working rking - yeah!!!
This commit is contained in:
parent
ee8aedd857
commit
f1711831f7
1970 changed files with 147377 additions and 55 deletions
37
node_modules/enhanced-resolve/lib/util/memoize.js
generated
vendored
Normal file
37
node_modules/enhanced-resolve/lib/util/memoize.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {() => T} FunctionReturning
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {FunctionReturning<T>} fn memorized function
|
||||
* @returns {FunctionReturning<T>} new function
|
||||
*/
|
||||
const memoize = (fn) => {
|
||||
let cache = false;
|
||||
/** @type {T | undefined} */
|
||||
let result;
|
||||
return () => {
|
||||
if (cache) {
|
||||
return /** @type {T} */ (result);
|
||||
}
|
||||
|
||||
result = fn();
|
||||
cache = true;
|
||||
// Allow to clean up memory for fn
|
||||
// and all dependent resources
|
||||
/** @type {FunctionReturning<T> | undefined} */
|
||||
(fn) = undefined;
|
||||
return /** @type {T} */ (result);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = memoize;
|
||||
Loading…
Add table
Add a link
Reference in a new issue