@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('nth', function (int $n, array $list) { |
|
6 | +P::macro('nth', function(int $n, array $list) { |
|
7 | 7 | $index = $n < 0 ? count($list) + $n : $n; |
8 | 8 | |
9 | 9 | return isset($list[$index]) ? $list[$index] : null; |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('flatMap', function (callable $mapper, array $list): array { |
|
6 | +P::macro('flatMap', function(callable $mapper, array $list): array { |
|
7 | 7 | return P::apply( |
8 | 8 | P::pipe([ |
9 | 9 | P::map($mapper), |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('chunk', function (int $size, $collection) { |
|
6 | +P::macro('chunk', function(int $size, $collection) { |
|
7 | 7 | $f = P::typeCond([ |
8 | 8 | ['array', P::partialRight('\\array_chunk', [$size])], |
9 | 9 | ['string', P::partialRight('\\str_split', [$size])], |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('mapIndexed', function (callable $fn, array $list): array { |
|
6 | +P::macro('mapIndexed', function(callable $fn, array $list): array { |
|
7 | 7 | $keys = array_keys($list); |
8 | 8 | $mapped = array_map($fn, $list, $keys); |
9 | 9 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('find', function (callable $predicate, array $list) { |
|
6 | +P::macro('find', function(callable $predicate, array $list) { |
|
7 | 7 | foreach ($list as $item) { |
8 | 8 | if (true === $predicate($item)) { |
9 | 9 | return $item; |
@@ -3,6 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('reject', function (callable $predicate, array $list): array { |
|
6 | +P::macro('reject', function(callable $predicate, array $list): array { |
|
7 | 7 | return P::filter(P::negate($predicate), $list); |
8 | 8 | }); |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('slice', function (int $offset, int $length, $collection) { |
|
6 | +P::macro('slice', function(int $offset, int $length, $collection) { |
|
7 | 7 | return P::apply( |
8 | 8 | P::typeCond([ |
9 | 9 | ['array', P::partialRight('\\array_slice', [$offset, $length])], |
@@ -3,6 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('none', function (callable $predicate, array $list): bool { |
|
6 | +P::macro('none', function(callable $predicate, array $list): bool { |
|
7 | 7 | return P::all(P::negate($predicate), $list); |
8 | 8 | }); |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('any', function (callable $predicate, array $list): bool { |
|
6 | +P::macro('any', function(callable $predicate, array $list): bool { |
|
7 | 7 | foreach ($list as $value) { |
8 | 8 | if (true === $predicate($value)) { |
9 | 9 | return true; |