mirror of
https://github.com/idanoo/GoScrobble
synced 2025-06-30 21:22:18 +00:00
10 lines
No EOL
182 B
JavaScript
10 lines
No EOL
182 B
JavaScript
export default function memoize(fn) {
|
|
var cache = {};
|
|
return function (arg) {
|
|
if (cache[arg] === undefined) {
|
|
cache[arg] = fn(arg);
|
|
}
|
|
|
|
return cache[arg];
|
|
};
|
|
} |