toss / es-toolkit

A modern JavaScript utility library that's 2-3 times faster and up to 97% smaller—a major upgrade to lodash.
https://es-toolkit.slash.page
Other
6.28k stars 267 forks source link

feat(every): Add `every` function #475

Open iDevGon opened 1 week ago

iDevGon commented 1 week ago

293

This pull request implements the every function, which behaves similarly to the every function in lodash.

The function takes a collection and a predicate function as parameters and checks if all elements in the collection pass the predicate, returning true or false..

Below is a benchmark comparing our every function to lodash's every.

스크린샷 2024-09-05 23 31 41
vercel[bot] commented 1 week ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
es-toolkit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 5, 2024 3:33pm
raon0211 commented 1 week ago

Hello, thanks for your pull request!

I think we should add this function to our compat library, since we recommend our users of the library to use the native counterpart (here, Array#every) if possible. Could you move our library to the compat library, as in concat?

Also, in order to be in the compat library, we have to move lodash's test cases to our library. Could you help this if possible?

iDevGon commented 1 week ago

@raon0211 Sure! I'll complete that task and update this PR soon 😁