Skip to content

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

Merged
taylorotwell merged 1 commit into
laravel:7.xfrom
JosephSilber:take-while
Apr 22, 2020
Merged

taylorotwell merged 1 commit into
laravel:7.xfrom
JosephSilber:take-while

Conversation

@JosephSilber

Copy link
Copy Markdown
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
Copy Markdown
Contributor

Looks like the circle is complete. Thanks!

salmanarshad321 pushed a commit to salmanarshad321/framework that referenced this pull request Sep 23, 2026
[7.x] Add `takeUntil` and `takeWhile` collection methods
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