Fast and small validation framework based on schemas, inspired by Laravel.
You can install max-validator
using any package manager:
npm i @shrtns/max-validator
import { validate } from 'https://cdn.skypack.dev/@shrnts/max-validator'
const user = {
firstname: 'John',
lastname: 'Doe',
age: 20,
}
const schema = {
firstname: 'required|string|min:3',
lastname: 'required|string|min:3',
age: 'number',
}
const validation = validate(user, schema)
console.log(validation.passed()) // true
You can check out the docs for more information.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.