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

Rename the failable map overload to compactMap #1180

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

younata
Copy link
Member

@younata younata commented Dec 12, 2024

Yes, I just submitted the PR adding this new matcher. Then I thought on it some more and decided I didn't like the slightly different behavior between 2 different versions of map.

Instead, I renamed the map with optional transform to compactMap (which you can tell from the documentation that this was the original name before I made a decision to rename it to just map), and added another overload of map that takes a closure returning an optional that behaves exactly like how the map without optional behaves.

I also redid the tests to be sure to check all of this.

Checklist - While not every PR needs it, new features should consider this list:

  • Does this have tests?
  • Does this have documentation?
  • Does this break the public API (Requires major version bump)?
  • Is this a new feature (Requires minor version bump)?

And also provide another overload of map that takes in an optional and behaves much more closely to what the original map matcher does
@younata younata merged commit 725e5a3 into main Dec 12, 2024
5 of 16 checks passed
@younata younata deleted the rename_optional_map_to_compactMap branch December 12, 2024 00:52
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.

1 participant