DEV Community

Discussion on: Sorting an array into groups with reduce

 
jacobmparis profile image
Jacob Paris

Oh yes -- I understand now.

I'm a strong believer in refactoring code for reusability, so if I needed to group more arrays by one of their fields I would absolutely adopt a specialized and well-named function that does that. In this case, Lodash is a perfectly acceptable alternative.