Reduce an iterator to an object grouped on keys, with arrays containing grouped values.