Skip to content

Commit

Permalink
refactor: Minor update on MatchOne operation.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Apr 15, 2021
1 parent 9a7931c commit b913a6b
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/Operation/MatchOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,10 @@ static function (callable ...$callbacks) use ($matchers): Closure {
*/
static fn ($value, $key, Iterator $iterator): bool => $reducer1($value, $key, $iterator) === $reducer2($value, $key, $iterator);

$dropWhileCallback =
/**
* @param mixed $value
* @psalm-param T $value
*/
static fn (bool $value): bool => false === $value;

/** @psalm-var Closure(Iterator<TKey, T>): Generator<TKey|int, bool> $pipe */
$pipe = Pipe::of()(
Map::of()($mapCallback($callbackReducer($callbacks))($callbackReducer($matchers))),
DropWhile::of()($dropWhileCallback),
DropWhile::of()(static fn (bool $value): bool => false === $value),
Append::of()(false),
Head::of()
);
Expand Down

0 comments on commit b913a6b

Please sign in to comment.