Im trying to validate an object that can have dynamic keys, named itineraryN, where N can be a number from 0 to 99., something like this (yes, it has to be a dictionary)
At the same time, I want to make validation to the object shapes inside the itineraryN key.
This is what I've done so far, but I can seem to find a way to validate the keys (currentValue). I was thinking on adding a regex expression (new RegExp(/^itinerary[0-9]{1,2}$/)) inside the reduce, but Im not sure how to make the validation invalid from there.
Im trying to validate an object that can have dynamic keys, named
itineraryN
, where N can be a number from 0 to 99., something like this (yes, it has to be a dictionary)At the same time, I want to make validation to the object shapes inside the
itineraryN
key.This is what I've done so far, but I can seem to find a way to validate the keys (
currentValue
). I was thinking on adding a regex expression (new RegExp(/^itinerary[0-9]{1,2}$/)
) inside the reduce, but Im not sure how to make the validation invalid from there.