DusanKasan/Knapsack

Documentation Bug - mapcat

will1471 opened this issue · 1 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