Possible to do in one loop?
api returns this, shouldve been grouped by materialName can we do that in one loop?
10 Replies
came up with this rn
better way to do this?
Solution
Thanks you're a god @nickserv
Note that I'm using
groupBy
from the TC39 proposalI'm using lodash so no worries
You'll have to use a supported environment or polyfill it, and then replace it with
Map.groupBy
or Object.groupBy
depending on what you want it to returnYou don't need lodash for this imo
we already use it in the project
In that case you should probably use their primitives instead of my callback functions
okk
thanks