sindresorhus/memoize
Auf GitHub ansehenWarn when `cacheKey` is unset and `function.length > 1`?
Open
#90 geöffnet am 1. Feb. 2023
enhancementhelp wanted
Beschreibung
By default, only the memoized function's first argument is considered via strict equality comparison
I think mem should call console.warn in this case:
mem(async (host, path) => fetch(host + path))
Correct usage:
mem(async (host, path) => fetch(host + path), {
cacheKey: args => args.join()
})
mem(async (host, path) => fetch(host + path), {
cacheKey: JSON.stringify
})