Skip to content

Conversation

@ItsMalma
Copy link
Contributor

@ItsMalma ItsMalma commented Feb 28, 2025

I added a new method: ValueOr

This method is similar to ValueOrZero, the difference is that it will return the value put in the parameter instead of zero.

Is this method suitable for this library?

Copy link
Owner

@guregu guregu left a comment

Choose a reason for hiding this comment

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

Hello, I think it's a good idea. Although cmp.Or exists, it won't always work.
I'll merge this if you add the methods/tests to the zero subpackage too. Their APIs need to match.

@ItsMalma ItsMalma requested a review from guregu March 4, 2025 19:37
Copy link
Owner

@guregu guregu left a comment

Choose a reason for hiding this comment

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

Thanks!

@guregu guregu merged commit 60d6091 into guregu:main Mar 5, 2025
1 check passed
@guregu
Copy link
Owner

guregu commented Mar 5, 2025

This is released as v6 now. Bumped the major version just to be safe.

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

Successfully merging this pull request may close these issues.

2 participants