0.0.2 • Published 3 years ago

@mikrav/reval v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Reval

Simple validation schema for Rescript.

Install

npm install @mikrav/reval

Usage

open Reval

let schema = Schema.Dict(
  [RequiredKeys(["name", "age"])],
  [
    //
    ("name", String([MinLength(2)])),
    ("age", Int([GTE(0)])),
    ("description", String([NotEmpty])),
  ],
)

let input = Input.Dict([
  //
  ("name", String("Moona"))
  ("age", Int(3)),
  ("description", String("Hello"))
])

validate(schema, input)

// output:
// result<Input.t, Error.t>
0.0.2

3 years ago

0.0.1

3 years ago