Closed mdariftiens closed 16 hours ago
Thanks for submitting a PR!
Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.
Pull requests that are abandoned in draft may be closed due to inactivity.
Would be great if this supports iterable
so generators with large dataset could be chunked as well.
@MatusBoa thanks for your comment. Updated code and test for the supports iterable
.
Thanks for your pull request to Laravel!
Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.
If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!
For these types of methods, it's best to have practical use cases in real world applications provided.
Introducing Arr::chunkBy(). Split an iterable into chunks based on a callback function. Each chunk will contain consecutive elements until the callback's return value changes
Detailed Impact:
ChunkBy Method: Benefit: Dynamically segments iterable based on conditions. Common Use: Log analysis, temporal grouping, or state-based processing. Performance: Efficient for moderately sized iterable with clear grouping logic.
Example usages: