Shortened code. It now also follows the styleguide more precisely. Improved description.
Tried to reproduce the groupBy behaviour from the lodash lib. https://lodash.com/docs/4.17.4#groupBy