Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aosasona/crossbar
Data validation library in pure Gleam
https://github.com/aosasona/crossbar
gleam validation-library
Last synced: 3 months ago
JSON representation
Data validation library in pure Gleam
- Host: GitHub
- URL: https://github.com/aosasona/crossbar
- Owner: aosasona
- Created: 2024-01-14T16:59:58.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-02-19T13:14:20.000Z (9 months ago)
- Last Synced: 2024-05-01T13:39:03.365Z (7 months ago)
- Topics: gleam, validation-library
- Language: Gleam
- Homepage: https://hexdocs.pm/crossbar
- Size: 63.5 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-gleam - crossbar - [📚](https://hexdocs.pm/crossbar/) - Data validation library in pure Gleam (Packages / Validation)
README
# crossbar
[![Package Version](https://img.shields.io/hexpm/v/crossbar)](https://hex.pm/packages/crossbar)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/crossbar/)## Usage
```gleam
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:
```gleam
Error([FailedRule("age", "min_value", "must be at least 18.0")])
```## Installation
```sh
gleam add crossbar
```Documentation can be found at .