Async/Await Syntax
What optimization pattern is implemented here?
const cache = new Map();
async function memoized(fn) {
return async function(...args) {
const key = JSON.stringify(args);
if (cache.has(key)) {
return cache.get(key);
}
const result = await fn(...args);
cache.set(key, result);
return result;
};
}