Re:Using the switch(true) pattern in JavaScript
by CloselyChunky on Monday April 12, 2021 @12:16PM
(#26781193)
Sure, if you have an either/result type, the whole thing becomes a fold, where each validator is a function from user to Either<Error, User> and then
This way you'll end up with either the validated user, or the first error that occurred and all the other validators were skipped.
[ Parent
| on HN ]
There are no comments on this comment yet.