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

feat: add selectFirst function #52

Merged
merged 1 commit into from
Jun 30, 2024

Conversation

adamhamlin
Copy link
Contributor

@adamhamlin adamhamlin commented Jun 29, 2024

Tip

The owner of this PR can publish a preview release by commenting /publish in this PR. Afterwards, anyone can try it out by running pnpm add radashi@pr<PR_NUMBER>.

Summary

selectFirst is very similar to select, but instead of returning a list of mapped values meeting some condition, it returns only the first such value--short-circuiting when it does. If no value meets the condition, it returns undefined.

See #9 (comment) for more background info/rationale.

Related issue, if any:

What kind of change does this PR introduce?

Feature

For any code change,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed

Does this PR introduce a breaking change?

No

package.json Outdated Show resolved Hide resolved
@adamhamlin adamhamlin changed the title feat: Add selectFirst feat: add selectFirst Jun 29, 2024
@adamhamlin adamhamlin changed the title feat: add selectFirst feat: add selectFirst function Jun 29, 2024
@aleclarson
Copy link
Member

This looks great!

Want me to add you to the core team?

@aleclarson aleclarson added the new feature This PR adds a new function or extends an existing one label Jun 29, 2024
@aleclarson aleclarson added this pull request to the merge queue Jun 30, 2024
Merged via the queue into radashi-org:main with commit f792633 Jun 30, 2024
5 checks passed
@adamhamlin
Copy link
Contributor Author

adamhamlin commented Jun 30, 2024

This looks great!

Want me to add you to the core team?

Sure, let's do it. Thanks

@adamhamlin adamhamlin deleted the feat/add-selectFirst branch June 30, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature This PR adds a new function or extends an existing one
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants