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(array): unanimous #5

Merged
merged 5 commits into from
Aug 25, 2023
Merged

feat(array): unanimous #5

merged 5 commits into from
Aug 25, 2023

Conversation

TylerR909
Copy link
Contributor

I've been writing several checks of the form...

const thingsMatch = array.every((el, _, [first]) => el.path.to.property === first.path.to.property);

lately and I'd like it to just be built-in.

Copy link
Contributor

@zgavin zgavin left a comment

Choose a reason for hiding this comment

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

nice 👍

@stephenh
Copy link
Contributor

stephenh commented Aug 24, 2023

@zgavin kinda surprised you 👍 :-) I was going to soft -1 b/c I was thinking we'd stay within the real of "mainstream as-in methods that have shown up in other collection libraries", i.e. the Ruby & Scala collections being the "most ergonomic" in terms of helper methods. I.e. we've taken .nonEmpty from Scala, many from Ruby, so we'd continue that pattern.

I personally haven't seen a .unanimous method, either by that name or a different name (iirc), so was thinking this wouldn't meet the bar for inclusion.

But 🤷 you're thinking why not?

(Now I'm curious to check Scala to see if they have something like this...)

src/array.ts Outdated Show resolved Hide resolved
src/array.ts Outdated Show resolved Hide resolved
@zgavin
Copy link
Contributor

zgavin commented Aug 24, 2023

@stephenh I think we've added some novel things things purely to suite our needs already, so I'm good with adding it. For approvals this is a pattern that's come up a couple times.

Copy link
Contributor

@stephenh stephenh left a comment

Choose a reason for hiding this comment

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

+1 with the caveat I 8.5-out-of-10 prefer the name everyHasSame

Copy link
Contributor

@stephenh stephenh left a comment

Choose a reason for hiding this comment

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

👍

@TylerR909 TylerR909 merged commit e9e5e51 into main Aug 25, 2023
3 checks passed
@TylerR909 TylerR909 deleted the feat/array-unanimous branch August 25, 2023 19:43
@homebound-team-bot
Copy link

🎉 This PR is included in version 1.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

4 participants