DusanKasan / Knapsack

Collection pipeline library for PHP

Home Page:http://dusankasan.github.io/Knapsack/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Documentation Bug - mapcat

will1471 opened this issue · comments

The examples for mapcat appear to be wrong.

Collection::from([1, 3, 3, 2])
    ->mapcat(function ($value) {
        return [[$value]];
    })
    ->toArray()

outputs [[2]] not [[1], [3], [3], [2]]

Presumably a call to values needs adding in the examples. eg

Collection::from([1, 3, 3, 2])
    ->mapcat(function ($value) {
        return [[$value]];
    })
    ->values()
    ->toArray()

Good catch, fixed in 5e3619e