@validate.it/rules
Installation
// If you are using npm
npm install --save @validate.it/rules
// If you are using yarn
yarn add @validate.it/rules
Rule structure
Validation rules are JS objects containing a message
and a check
functions.
{
message: Function (options: Object),
check: Function (options: Object)
}
Each of these methods accepts an options object containing:
-
value <Any>
: value of the field being validated -
attribute <String>
: The name of the validated field -
data <Object>
: object containing all the fields being validated -
args <Array>
: An array containing the options passed to the validation rules in order
Available rules
- accepted
- after
- afterOrEqual
- alpha
- array
- before
- beforeOrEqual
- between
- boolean
- confirmed
- date
- dateEquals
- dateFormat
- different
- digits
- digitsBetween
- distinct
- greaterThan
- greaterThanOrEqual
- inArray
- integer
- ip
- ipv4
- ipv6
- json
- lessThan
- lessThanOrEqual
- max
- mimetypes
- mimes
- min
- notIn
- notRegex
- nullable
- numeric
- oneOf
- present
- regex
- required
- requiredIf
- requiredUnless
- requiredWith
- requiredWithAll
- requiredWithout
- requiredWithoutAll
- same
- size
- string
- url
Version log
-
v0.0.x:
- Initial commits
- Created first rules