Skip to content

Commit

Permalink
refactor: Simplify DropWhile operation.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Dec 29, 2021
1 parent 1935d11 commit e794b79
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Operation/DropWhile.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,9 @@ public function __invoke(): Closure
* @return Generator<TKey, T>
*/
static function (Iterator $iterator) use ($callbacks): Generator {
$result = true;

foreach ($iterator as $key => $current) {
if (true === $result) {
if (true === $result = CallbacksArrayReducer::or()($callbacks, $current, $key, $iterator)) {
continue;
}
if (CallbacksArrayReducer::or()($callbacks, $current, $key, $iterator)) {
continue;
}

break;
Expand Down

0 comments on commit e794b79

Please sign in to comment.