1.2.2 • Published 3 years ago
js-input-field-validator v1.2.2
JS-Input-Field-Validator
Installation
$ npm i js-input-field-validator
Usage
const jsInputFieldValidator = require("js-input-field-validator");
const error = jsInputFieldValidator([
{ value: "Alex", type: "text", min: 4, max: 8, field: "name" },
{ value: 123, type: "number", min: 3, max: 5, field: "number" },
{ value: "testing testing", type: "any", field: "note" },
{ value: "alex@gmail.com", type: "email", field: "email" }
]);
if (error) {
console.log(error);
} else {
// Take your prefared action if the validation process passes.
console.log("Validation process passed");
}