1.0.1 • Published 6 years ago

tcomb-validators v1.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

tcomb-validators :fire:

Ready, customizable and scalable validators to use with tcomb forms system or as standalone solution can be used in client side or server.

Install

npm i --save tcomb-validators

Usage

Standalone Usage

import validate, { Email, Min, Max } from 'tcomb-validators;

validate('example.com', Email()); // => false
validate('Hello world', [ Min(5), Max(10) ]); // => true

Tcomb Usage

import { tValidate,  Email, Min, Max } from 'tcomb-validators;

type: t.struct({
  name: tValidate([
    Min(5),
    Max(10),
    Email()
  ])
})`

Validators

ValidatorDescriptionParameters
EmailIf valid email-
Minvalidate input min lenght1 param -> Number
Maxvalidate input max lenght1 param -> Number

Validators will be updated every period.