Skip to content

Latest commit

 

History

History
21 lines (18 loc) · 522 Bytes

README.md

File metadata and controls

21 lines (18 loc) · 522 Bytes

Valid

A validation library for gleam!

Validators are functions which check the properties of data and raise generic issues.

fn bounded(
  validator: Validator(x, Int, i),
  between min: Int,
  and max: Int,
  raise issue: i,
) -> Validator(x, Int, i) {
  use int <- extend(validator)
  case min < int && int < max {
    True -> valid(int)
    False -> invalid(int, issue)
  }
}

This package has not yet been published to Hex (but it will be as soon as I figure out how to do that).