Enables functional style syntax eg $list->filter($cb)->map($cb2)

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/kdaviesnz/list

v0.1.0 2019-06-04 03:03 UTC

This package is not auto-updated.

Last update: 2025-10-16 08:40:33 UTC


README

Problem

You have an array and you need to remove anything that is not a number and double everything else.

Solution

$a = kdaviesnz/utilities/lists([null, "apple", 1,2,3]);

$result = $a->filter(function($item) { return is_numeric($item) } )->map(function($item) { return $item * 2 } )()

$a_parsed = $result()

See tests/listsTest.php

lists