Skip to content

Releases: samsonasik/ArrayLookup

Released: ArrayLookup 2.1.1

16 Dec 08:12
2.1.1
1e0c0e4

Choose a tag to compare

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

04 Dec 22:55
2.1.0
e61c61c

Choose a tag to compare

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

25 Jun 02:40
2.0.3
3b815db

Choose a tag to compare

[DX] Early check nullable any type on Filter

Released: ArrayLookup 2.0.2

20 Jun 02:00
2.0.2
cb4cc9a

Choose a tag to compare

[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

05 Jun 16:55
2.0.1
ce1fb91

Choose a tag to compare

What's Changed

Enhancement

  • [Doc] Better documentation: make list number clickable
  • [DX] include DX improvement for callable filter error message that can possibly returns ReflectionUnionType or ReflectionIntersectionType

Changelog 2.0.0...2.0.1

Released: ArrayLookup 2.0.0

28 Dec 13:26
2.0.0
f2cb43a

Choose a tag to compare

What's Changed

🚀🚀🚀 It brings performance improvement with 🚀 Faster process with early validate filter callable before loop

Enhancement

Full Changelog: 1.8.1...2.0.0

Released: ArrayLookup 1.8.1

01 Nov 10:49
1.8.1
c26a928

Choose a tag to compare

What's Changed

  • Fix Psalm Crash by Removing Equals Sign in @ param Annotations by @nynka in #26

New Contributors

  • @nynka made their first contribution in #26

Full Changelog: 1.8.0...1.8.1

Released: ArrayLookup 1.8.0

07 Sep 16:39
1.8.0
1f4027d

Choose a tag to compare

1.8.0

ci build Code Coverage PHPStan

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

07 Sep 13:36
1.7.0
d3c90d4

Choose a tag to compare

1.7.0

ci build Code Coverage PHPStan

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

30 Mar 16:32
1.6.0
be860ef

Choose a tag to compare

1.6.0

ci build Code Coverage PHPStan

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]