rjhilgefort
8/8/2018 - 8:02 PM

validateRequired

// 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)