If part of the data looks like this
someArray : [
{ id : "A", value : "10" },
{ id : "B", value : "20" },
{ id : "C", value : "30" }
]
can this part be transformed to
someObject : {
A : { id : "A", value : "10" },
B : { id : "B", value : "20" },
C : { id : "C", value : "30" }
}
?
Maybe if the run function in an operate block gets passed the whole item you could do something like this
operate : [
{
run : function (val, item) {
item.someObject[val.id] = val;
return val;
},
on : "someArray"
}
]
Just a naive idea basically but I wondered if there is a functionality already built-in. Mapping an Array into an Object is something I use very often.
If part of the data looks like this
can this part be transformed to
?
Maybe if the
runfunction in an operate block gets passed the whole item you could do something like thisJust a naive idea basically but I wondered if there is a functionality already built-in. Mapping an Array into an Object is something I use very often.