wmc/common/memoize.js
Paul Mathieu 33733c6fe4 Move a few things around
- common files to a new 'wmc-common' package in common/
- skycraft now puts all serving files into static/
2025-02-12 19:06:34 +01:00

12 lines
204 B
JavaScript

export function memoize(f) {
const memo = {};
function g(...args) {
if (!(args in memo)) {
memo[args] = f(...args);
}
return memo[args];
}
return g;
}