Released: ArrayLookup 1.8.0
1.8.0
Allow optional when on Collector
class, just transform, no filter.
$data = [
' a ',
' b ',
' c ',
];
transformed trim new data with:
use ArrayLookup\Collector;
$transform = fn (string $datum): string => trim($datum);
$newArray = Collector::setUp($data)
->withTransform($transform)
->getResults(); // ['a', 'b', 'c']