Echo JS 0.11.0

<~>
tracker1 3036 days ago. link 1 point
flatmap is just map + reduce

    invoices
      .map(inv => inv.positions)
      .reduce((a, p) => a.concat(p || []), []);

ex:

    function flatmap(object, mapper) {
      return object.map(mapper)
        .reduce((agg, ary) => agg.concat(ary || []), [])
    }

Replies