chriso/node-validator — pull request #112 by jbarata (2012-09-17 21:18:15+00:00)
Title: fixed _errors array reset on check - exception bypass mode

The "exception bypass" mode suggested in the last part of the read me is not working.
The _errors array was being reseted every time a .check('something') was called.

the fix maintains the list of _errors already collected.

In the ReadMe example:

Validator.prototype.error = function (msg) {
this._errors.push(msg);
}

Validator.prototype.getErrors = function () {
return this._errors;
}

var validator = new Validator();

validator.check('abc').isEmail();
validator.check('hello').len(10,30);

var errors = validator.getErrors(); // ['Invalid email', 'String is too small']

The output is actually: ['String is too small'], i.e ignores first errors