Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically use WeakMap when possible #56

Merged
merged 5 commits into from
Apr 12, 2020
Merged

Conversation

fregante
Copy link
Collaborator

@fregante fregante commented Apr 10, 2020

mem doesn't need Map, it's just that WeakMap doesn't support most primitives. If it could, it should only use WeakMap

Proposal: use WeakMap...

  • if cache isn't provided by the user
  • when the current key is supported by WeakMap

This is automatic and silent.

@sindresorhus
Copy link
Owner

It needs to be documented though: https://github.com/sindresorhus/mem#cache

readme.md Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants