https://github.com/ailixter/gears-pipeline
The project that gears pipelines.
https://github.com/ailixter/gears-pipeline
efficiency every filter find functional iterable map pipeline reduce some
Last synced: 9 months ago
JSON representation
The project that gears pipelines.
- Host: GitHub
- URL: https://github.com/ailixter/gears-pipeline
- Owner: ailixter
- License: mit
- Created: 2019-09-07T08:07:05.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-07T18:55:25.000Z (almost 7 years ago)
- Last Synced: 2025-01-18T00:30:47.311Z (over 1 year ago)
- Topics: efficiency, every, filter, find, functional, iterable, map, pipeline, reduce, some
- Language: PHP
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gears-pipeline
The project that gears pipelines.
it runs a chain of handlers over iterables (iterators, generators, arrays).
the processing is memory efficient, no intermediate arrays are used.
```php
echo PipelinedIteration::over(
[1, 2],
[3, 4],
[5, 6],
[7, 8]
)
->map(function ($a, $b, $c, $d) {
return [$a + $b, $c + $d];
})
->reduce(function ($r, $x, $y) {
return $r += $x * $y;
})
->getResult(); // 132
```
## implemented handlers
- ``map(callable)``
- ``filter(callable)``
- ``reduce(callable, mixed = 0)``
- ``find(callable)``
- ``some(callable)``
- ``every(callable)``