crossbar

Package Version Hex Docs

Usage

import gleam/io
import crossbar.{int, max_value, min_value, required, to_float, validate}

pub fn main() {
 int("age", 16)
 |> to_float
 |> required
 |> min_value(18.0)
 |> max_value(21.0)
 |> validate
 |> io.debug
}

The snippet above will return the following error:

Error([FailedRule("age", "min_value", "must be at least 18.0")])

Installation

gleam add crossbar

Documentation can be found at https://hexdocs.pm/crossbar.

Search Document