Better compatibility with functional programming
mickdekkers opened this issue · 0 comments
mickdekkers commented
Currently, vakt.check
always throws. This is a side-effect and thus undesirable for fp.
We could rename check
to assert
and add a non-throwing validation method.
Not sure on the exact API yet. For fp using an Either(Error, value)
would probably be best, but it would add an unnecessary dependency and increase the bundle size even for users that only use the throwing version. Perhaps going the lodash route of vakt/fp
or vakt/fantasy
could be a solution?