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

[7.x] Add takeUntil and takeWhile collection methods #32496

Merged
merged 1 commit into from
Apr 22, 2020

Conversation

JosephSilber
Copy link
Contributor

In #32262, we added an until collection method.

That naming is quite unfortunate, given that takeWhile is practically an industry standard. It's used by Rails, Python, Haskell, Lodash, RxJS, Java, Kotlin, C#/LINQ and countless others.

In most cases, there are both takeWhile and takeUntil variants.


This PR introduces two new methods: takeWhile and takeUntil. The existing until method is now just an alias to takeUntil.


I would also propose marking until as deprecated, and switch the docs to only show takeUntil and takeWhile.

@JosephSilber JosephSilber changed the title Add takeUntil and takeWhile collection methods [7.x] Add takeUntil and takeWhile collection methods Apr 22, 2020
@taylorotwell taylorotwell merged commit 3eb9445 into laravel:7.x Apr 22, 2020
@JosephSilber JosephSilber deleted the take-while branch April 22, 2020 21:22
@jasonmccreary
Copy link
Contributor

Looks like the circle is complete. Thanks!

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.

3 participants