sindresorhus/memoize
View on GitHubWarn when `cacheKey` is unset and `function.length > 1`?
Open
#90 opened on Feb 1, 2023
enhancementhelp wanted
Repository metrics
- Stars
- (1,155 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
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
})