/** * Note: the cache map can contain null and false values, so the function must check that the result is strictly not undefined */ export async function getFromCacheMap(cache: Map, key: Key, runner: (key: Key, ...args: Args) => Promise, ...args: Args): Promise { const result = cache.get(key) return result !== undefined ? result : runner(key, ...args) }