This repository has been archived by the owner on Jan 8, 2022. It is now read-only.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Inspired by `[Enmap](https://enmap.evie.dev)#ensure`, `Collection#ensure` gets an element with the specified key if it exists, otherwise sets it to the provided `defaultValue` and returns the `defaultValue`. Useful for things like per-guild settings where you want to either get it or set it to a default value.
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Signed-off-by: Kyran Mendoza <mendozakyran8@gmail.com>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
kyranet
suggested changes
Nov 24, 2021
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
kyranet
suggested changes
Nov 24, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one last thing, let's keep the setup step tidy :P
kyranet
suggested changes
Nov 24, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now for real, one last thing before LGTM, sorry!
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
kyranet
previously approved these changes
Nov 24, 2021
ImRodry
suggested changes
Nov 24, 2021
ImRodry
reviewed
Nov 24, 2021
implemented suggested changes by kyranet Co-authored-by: muchnameless <12682826+muchnameless@users.noreply.github.com>
kyranet
suggested changes
Nov 24, 2021
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
ImRodry
reviewed
Nov 24, 2021
ImRodry
reviewed
Nov 24, 2021
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
kyranet
suggested changes
Nov 25, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One little documentation thing, then I'll re-approve.
implemented suggested change Co-authored-by: Antonio Román <kyradiscord@gmail.com>
kyranet
approved these changes
Nov 25, 2021
iCrawl
approved these changes
Dec 6, 2021
Any ETA for when this will be merged? Would love to see this and #48 in a future release! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a continuation of #40 which was closed by the author.
I found @kxmndz 's PR to be useful and wanted to ensure that it was maintained.
Potential Usage Example:
Noticeable deviations from PR #40:
collection#ensure
can now beundefined|null
whereas before a non-nullish return value was expected.key: K, collection: this
.I believe that recycling these into the generator function will allow for less repetition in the end-user's code.
undefined|null
as a valid ensured value, therefore it was not implemented into this PR.Tests:
I'm not good at writing tests and would appreciate if someone help could contribute tests to cover the additional functionality added by this PR compared to the tests carried over by #40.
Status and versioning classification: