Id like to loop over an array of objects which is of unknown length and (some) unknown content and create a new set of enumerated arrays.
I know that the array has a consistent set of key:value pairs, which I'd like to use a reference to chunk out the array.
Here's the example array:
[{something:test,value:10},{something:example,value:20},{something:test,value:30}]
The function should recognize the key 'something' and create a number of arrays based on the variations of the corresponding value, so for example, in this case 2 arrays would result with an object form:
{
test: [{something:test,value:10},{something:test,value:30},
example: [{something:example,value:20}]
}
In other words I need to chunk an array based on some items value in the array, rather than size / length.
I have considered / tried using index on values etc to get size parameter, but this seems a like a huge undertaking, and I'm sure there's a faster solution.
Lodash etc do not seem to have something like this in their library.