Skip to content

JamShady/validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Validator

A light-weight validator, that applies a rule-set against a value, and returns the failures.

The rules are processed in the order of the example:

import validate from '@shady/validator'

// returns [] if there are no failing rules
const errors = validate(value, {
    required: boolean,
    min: number,
    max: number,
    gte: number,
    lte: number,
    pattern: RegExp | string,
    match: any,
    differ: any,
    differs: any[],
    email: boolean,
    onOrAfter: Date | string | number,
    onOrBefore: Date | string | number,
})

About

Utility library for defining and executing form validation rules

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published