Echo JS 0.11.0

<~>

mscdex 2873 days ago. link 4 points
Saying "without loops" is a misnomer. This should've been titled something like "JavaScript functional array iteration" or similar.
tracker1 2873 days ago. link 2 points
No mention of reduce...

    Object.keys(obj)
      .map(k => foo(k, obj[k]))
      .reduce((a, b) => Object.assign(a, b), {});

that's one of my favorites... break up an object/hash map, do something to each, and reconstruct hash map... assuming `foo(k, v)` returns `{ [k]: bar(v) }`;

map is cool and powerful, but so is reduce.
babula 2873 days ago. link 3 points
Did you read the whole article? He mentions reduce towards the end.
tracker1 2873 days ago. link 1 point
My bad.. the data section in reduce was similar to filtering, I'd scrolled back to the top while reading, then back down, and got into filtering.