bkuhlmann/form-validator/1.2.1

NOTE: the latest version is 1.2.2

Rerouted (cache, verified). The original is gone. This copy comes from a Lamdera package cache made before it went. The Lamdera package server serves a copy recovered from a Lamdera package cache from 2021-02-13.

What we checked: Rebuilt from the unpacked sources in a Lamdera package cache (5 copies agree), which Elm only writes after the published SHA-1 checked out; elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip is our own, so its SHA-1 is not the published one.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/bkuhlmann/form-validator/zipball/1.2.1/

FormValidator.Models

The Form Validator component models.

type alias Form key =
List (Field key)

The form model which stores a list of fields for input and validation.

type alias Field key =
{ key : key
, value : String
, validators : Validators
, errors : Errors
}

The form field, identified by unique key, which stores a value, validators of that value, and validation errors (if any).

type alias Validators =
List Validator

A list of validators for a field.

type alias Validator =
String -> Maybe String

A field validator which evaluates to an error string (invalid) or nothing at all (valid).

type alias Values =
List Value

A list of field values to be validated.

type alias Value =
String

A field value to be validated.

type alias Errors =
List Error

The corresponding error messages of an invalid field value(s).

type alias Error =
Maybe String

The corresponding error message of an invalid field value.