Created
August 8, 2018 20:02
-
-
Save rjhilgefort/2b4d274633866935a49267b453033150 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// validateRequired :: [String] | String a -> a | ThrownError | |
const validateRequired = propOrPath => R.cond([ | |
[isString, R.compose(validateRequired, R.of)], | |
[R.T, path => R.when( | |
R.pathSatisfies(R.isNil, path), | |
R.compose( | |
fpThrow, | |
R.always(`"${path}" is required and must be present`), | |
) | |
)] | |
])(propOrPath) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment