We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I'm trying to use the library to map the below source to a flat version
Source
{ "id": "2", "type": "plan", "name": "silver", "pricings": [ { "amount": { "currency": "cad", "value": 5.99 }, "interval": { "type": 1, "duration": 30 } }, { "amount": { "currency": "cad", "value": 9.99 }, "interval": { "type": 2, "duration": 90 } } ] }
Target
{ "id": "2", "name": "silver", "amount": { "currency": "cad", "value": 5.99 }, "interval": { "type": 1, "duration": 30 } }, { "id": "2", "name": "silver", "amount": { "currency": "cad", "value": 9.99 }, "interval": { "type": 2, "duration": 90 } }
To achieve the above i'm using flatMap function. I tried couple of ways using StrictSchema
flatMap
StrictSchema
const result = plans.flatMap(x => { const plan = { id: x.id, name: x.name } return x.pricings.map(p => <Plan>{ ...plan, amount: p.amount, interval: p.interval }); });
Also, many times I need to do reverse mapping i.e. from Target to Source and for that I use reduce function
reduce
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I'm trying to use the library to map the below source to a flat version
Source
Target
To achieve the above i'm using
flatMap
function. I tried couple of ways usingStrictSchema
Also, many times I need to do reverse mapping i.e. from Target to Source and for that I use
reduce
functionThe text was updated successfully, but these errors were encountered: