How to transform array with shapeshift using default values?
I have an array which I'm trying to validate with shapeshift:
So is there a way I can use
banListWithReason
to transform the string array into object array?3 Replies
for more context:
bans
is an array of either string
or this:
If it is a string[]
then I have to transform it into banEntityWithReason[]
with defaultReason
supplied to itI dont think shapeshift can do this for you but if it can then it'll be in the
transform
function. I havent used that one though so you'll have to FAAFO
If not then you'll have to transform it yourself, shouldn't be too hard.Solution
Solution:
This does the transformation in the format I want.