Modernized fork of Validate.js, a declarative validation library.
npm install neovalidate
Toy example:
import Validator from 'neovalidate'
const validator = new Validator()
const constraints = {
username: {
presence: true
},
password: {
presence: true,
length: {
minimum: 8,
message: 'must be at least 8 characters'
}
}
}
const result = validator.validate({ password: 'qwerty' }, constraints)
console.log(result)
/*
{
username: [ "Username can't be blank" ],
password: [ "Password must be at least 8 characters" ],
}
*/
See https://validatejs.org/ for full docs.
If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.
For bugs and feature requests, don't hesitate to open issues!
neovalidate is distributed under MIT license. See LICENSE.txt for details.
This project is a derivative work of validate.js by Nicklas Ansman.