sindresorhus/memoize
Vedi su GitHubWarn when `cacheKey` is unset and `function.length > 1`?
Open
#90 aperta il 1 feb 2023
enhancementhelp wanted
Metriche repository
- Star
- (1155 star)
- Metriche merge PR
- (Nessuna PR mergiata in 30 g)
Descrizione
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
})