Question
I have been messing around with morphism for the past few weeks and thus far it has been a delight to use!
While using it to morph a array of object I encountered a scenario where I would like to remove a object from the array. Is this possible to do in a schema ?
Information
Schema
createSchema({
sku: orderItem => {
if (/* This sku looks good return it */) {
return orderItem.sku;
} else if (/** This sku is bad */) {
// we should remove this object
} else {
// Something else
}
},
// other data
});
Data
[
{
sku: 'goodsku',
// other data
},
{
sku: 'badsku'
// other data
}
]
Current Result
We set the value of sku to something like null and then loop through the array and remove all object that contain a sku: null
Current Result Data
[
{
sku: 'goodsku',
// other data
},
{
sku: 'null'
// other data
}
]
Ideal Result
Perhaps export a enum from morphism that signals this object should be removed. Perhaps this could be apart of #85?
Ideal Result Data
[
{
sku: 'goodsku',
// other data
}
]
Version
morphism: 1.12.0
Question
I have been messing around with morphism for the past few weeks and thus far it has been a delight to use!
While using it to morph a array of object I encountered a scenario where I would like to remove a object from the array. Is this possible to do in a schema ?
Information
Schema
Data
Current Result
We set the value of sku to something like null and then loop through the array and remove all object that contain a sku: null
Current Result Data
Ideal Result
Perhaps export a enum from morphism that signals this object should be removed. Perhaps this could be apart of #85?
Ideal Result Data
Version
morphism: 1.12.0