1.0.4 • Published 6 years ago

soft-validator v1.0.4

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

Tutorial para usar o soft-validator

const SoftValidator = require('soft-validator');

exports.post = 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()) {
    res.status(400).send(validator.errors()).end();
    return;
}

}

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago