cspell-lib
Version:
A library of useful functions used across various cspell tools.
14 lines • 375 B
JavaScript
import { isArrayEqual } from './util.js';
export function memorizeLastCall(fn) {
let last;
return (...p) => {
if (last && isArrayEqual(last.args, p)) {
return last.value;
}
const args = p;
const value = fn(...args);
last = { args, value };
return value;
};
}
//# sourceMappingURL=memorizeLastCall.js.map