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

Add clear() to MapCache #1380

Closed
jamiebuilds opened this issue Aug 3, 2015 · 5 comments
Closed

Add clear() to MapCache #1380

jamiebuilds opened this issue Aug 3, 2015 · 5 comments

Comments

@jamiebuilds
Copy link
Contributor

Currently building a rich translator using _.memoize, it'd be nice to memoizedFn.cache.clear() when the language changes.

Since the API is following the native Map I figure it should include the clear method:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/clear

@jamiebuilds
Copy link
Contributor Author

@megawac You mean memoized.cache.__data__ = {}, and I can, it's just not a nice API.

@jdalton
Copy link
Member

jdalton commented Aug 3, 2015

Hey @thejameskyle! Related to #882, #1269.

@jdalton jdalton closed this as completed Aug 3, 2015
@jdalton jdalton added the wontfix label Aug 3, 2015
@jamiebuilds
Copy link
Contributor Author

💩

@jdalton
Copy link
Member

jdalton commented Aug 3, 2015

The route would be to make _.memoize.Cache = Map.
The reason we punt on clear is because devs can do _.memoize.Cache = WeakMap.

@lock
Copy link

lock bot commented Jan 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants