node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป


Tutorial para usar o soft-validator

const SoftValidator = require('soft-validator'); = async(req, res, next) => { var firstText = 'Hello World!'; var secondText = 'Hey';

let validator = new SoftValidator();
validator.hasMaxLen(req.body.firstText, 5, 'Field with a maximum of 5 characters');
validator.hasMinLen(req.body.secondText, 5, 'Field with a minimum of 5 characters');

// Invalid data
if (!validator.isValid()) {