xxxxxxxxxx
function groupBy(array, keyFn) {
return array.reduce((accumulator, value) => {
const key = keyFn(value);
if (!accumulator[key]) {
accumulator[key] = [value];
} else {
accumulator[key] = [value];
}
return accumulator;
}, {});
}
xxxxxxxxxx
A group of one, two, three, or four elements that represents each pixel of an image in client memory. Thus, in the context of a client memory image, a group and a pixel are the same thing.