Closed ahallock closed 6 years ago
I feel like this can be handled by a simple higher order function, similar to what's in https://codeburst.io/composable-object-validations-in-js-efa1ebacc34e
Yes, this sounds reasonable. Not sure if this should be part of spected. The example shown by @Emilios1995 would solve the problem. Delegating the decision to user land should be the better approach. Would that example work for your case?
It works, thank you.
If a property is null or undefined, it's useful to stop validation there rather than execute the other validations. Otherwise, you have to check for null/undefined on all your subsequent validations.