Mapping source values to destination object keys dynamically
NFNChris opened this issue · 3 comments
NFNChris commented
Is it possible to map this:
[
{ condition: 'new', quantity: 5, id: 'x' },
{ condition: 'used', quantity: 3, id: 'y' },
{ condition: 'broken', quantity: 1, id: 'z' }
]
To this:
{
'new': { quantity: 5, id: 'x' },
'used': { quantity: 3, id: 'y' },
'broken': { quantity: 1, id: 'z' }
}
I didn't see any clear examples of mapping a source value to an object key in the destination.
This would be useful, for example, in quickly referencing the 'new' value object by key rather than having to search through the array to find it.
I have been trying to figure this out for the past few hours - any direction would be much appreciated!
Thanks,
Chris
nisargrthakkar commented
Any update on this??
Asafkbalink commented
Is this possible?
HemalathaBR commented
Any updates on this?