Namespace Validations

Functions taking some input and returning a Validation

// Validates that a string is not empty
export const nestring = (s: string): V.Validation<string, string> =>
s.length > 0 ? V.Success(s) : V.Warning(["Must be non-empty"], s);

When validating, Validation allows you to return:

  • Success - the value is valid
  • Warning - the value fails validation, but the value is available (e.g. we parsed a date from a string but it's out of the valid range)
  • Failure - the value fails validation because the value is unavailable (e.g. we tried to parse a date from a string and failed)

Index

Validations - Array

Validations - Text

Generated using TypeDoc