JS-Laravel-validation
All rules are base on documentation from https://laravel.com/docs/5.7/validation#available-validation-rules
- No dependencies
- Works in Node.js and browser
- Takes form data as an object
Setup
Install: npm install js-laravel-validation
Usage
import { validateForm } from 'js-laravel-validation'
const formData = {
username: {
value: 'test1',
validation: 'required|string'
},
password: {
value null,
validation: 'required|string'
}
}
const result = validateForm({ formData });
if (result.errors) {
console.log(formData.errors);
}
API
Missing Rules