Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Implement ChainedMap.getOrCompute #63

Merged
merged 1 commit into from
Aug 13, 2018

Conversation

simon04
Copy link
Contributor

@simon04 simon04 commented Jun 6, 2018

This allows shortening various if (!has) set; get; blocks.

@edmorley edmorley requested a review from eliperelman July 23, 2018 10:29
Copy link
Member

@eliperelman eliperelman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one tiny nit and I think we can merge. Thanks for this!

@@ -72,6 +72,13 @@ module.exports = class extends Chainable {
return this.store.get(key);
}

getOrCompute(key, fun) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can you rename this variable to f or fn?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 😄

@eliperelman eliperelman merged commit 40b8a98 into neutrinojs:master Aug 13, 2018
@eliperelman
Copy link
Member

Thank you so much!

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

Successfully merging this pull request may close these issues.

2 participants