Skip to content

Commit

Permalink
Merge pull request #16 from samsonasik/increment
Browse files Browse the repository at this point in the history
[Finder] Don't increment new key when preserveKey
  • Loading branch information
samsonasik authored Mar 6, 2024
2 parents a40d9d4 + ce993c4 commit f86a0e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ public static function rows(iterable $data, callable $filter, bool $preserveKey
continue;
}

if (! is_numeric($key)) {
if ($preserveKey || ! is_numeric($key)) {
$rowKey = $key;
} else {
$rowKey = $preserveKey ? $key : $newKey;
$rowKey = $newKey;
++$newKey;
}

Expand Down

0 comments on commit f86a0e1

Please sign in to comment.