proposal-array-grouping

A proposal to make grouping of items in an array easier.

const array = [1, 2, 3, 4, 5];

// groupBy groups items by arbitrary key.
// In this case, we're grouping by even/odd keys
array.groupBy((num, index, array) => {
  return num % 2 === 0 ? 'even': 'odd';
});

// =>  { odd: [1, 3, 5], even: [2, 4] }

Champions

Status

Current Stage: 2

Motivation

TODO

Polyfill