Releases: samsonasik/ArrayLookup
Released: ArrayLookup 2.1.1
What's Changed
- Make faster search on Finder::last() on SplFixedArray data by @samsonasik in #34
Full Changelog: 2.1.0...2.1.1
Released: ArrayLookup 2.1.0
Feature
Add new Finder::partition() functionality:
It splits data into 2 arrays: matching and non-matching, instead of 2 loops to get match and non-match, it just use single iteration, and already get both matching and non-matching data.
The valid example for this:
<?php
// Import CSV data and separate valid/invalid rows in one pass
$csvRows = $csvParser->parse('users.csv');
[$validUsers, $invalidUsers] = Finder::partition(
$csvRows,
fn($row) => $validator->validate($row)->isValid()
);
// Bulk insert valid users
$userRepository->bulkInsert($validUsers);
// Generate error report for invalid rows
$reportGenerator->createErrorReport($invalidUsers);Full Changelog: 2.0.3...2.1.0
Released: ArrayLookup 2.0.3
[DX] Early check nullable any type on Filter
Released: ArrayLookup 2.0.2
[DX] Fix message: no return means return mixed
[DX] Fix nullable message
Full Changelog: 2.0.1...2.0.2
Released: ArrayLookup 2.0.1
What's Changed
Enhancement
- [Doc] Better documentation: make list number clickable
- [DX] include DX improvement for callable filter error message that can possibly returns
ReflectionUnionTypeorReflectionIntersectionType
Changelog 2.0.0...2.0.1
Released: ArrayLookup 2.0.0
What's Changed
🚀🚀🚀 It brings performance improvement with 🚀 Faster process with early validate filter callable before loop
Enhancement
- Only upload test coverage on non-fork by @samsonasik in #27
- Bump to PHPStan 2.0 by @samsonasik in #28
- Version 2: 🚀 Faster process with early validate filter before loop by @samsonasik in #29
- Version 2: bump requirement to php 8.2 by @samsonasik in #30
Full Changelog: 1.8.1...2.0.0
Released: ArrayLookup 1.8.1
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']Released: ArrayLookup 1.7.0
1.7.0
Add new Collector class, for collect filtered data, with new transformed each data found, for example, we have data:
$data = [
' a ',
' b ',
' c ',
new \stdClass(),
];we need to collect new data into new array with transformed no space in results.
Before
$newArray = [];
foreach ($data as $datum) {
if (is_string($datum)) {
$newArray[] = trim($datum);
}
}After, with Collector class
use ArrayLookup\Collector;
$when = fn (mixed $datum): bool => is_string($datum);
$limit = 2;
$transform = fn (string $datum): string => trim($datum);
$newArray = Collector::setUp($data)
->when($when)
->withLimit(2) // optional to only collect some data provided by limit config
->withTransform($transform)
->getResults(); // ['a', 'b', 'c']Released: ArrayLookup 1.6.0
1.6.0
This bring new ability to gather only limited found data on Finder::rows():
$data = [1, 2];
$filter = static fn($datum): bool => $datum >= 0;
$limit = 1;
var_dump(
Finder::rows($data, $filter, limit: $limit)
); // [1]