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

Get with default value #225

Open
ghost opened this issue Jan 10, 2021 · 2 comments
Open

Get with default value #225

ghost opened this issue Jan 10, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 10, 2021

Just add the possibility of myCache.get( key, defaultObj ) where it returns defaultObj when key is not found. This is common in key value retrieval, which is simpler than a (if value==undefined) in general.

@flaviotordini
Copy link

Even better a get with a function to call to retrieve the default value. Even better support an async function (a Promise).

@doc-han
Copy link

doc-han commented Jul 7, 2021

Cool, this suggestion sounds great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants