Skip to content

Commit

Permalink
return error as null when valid
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmud committed Apr 24, 2014
1 parent e492817 commit d6889e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/validations.js
Expand Up @@ -403,7 +403,7 @@ Validatable.prototype.isValid = function (callback, data) {
validationsDone.call(inst, function() {
if (valid) cleanErrors(inst);
if (callback) {
callback(new ValidationError(this), valid);
callback(valid ? null : new ValidationError(this), valid);
}
});
}
Expand All @@ -414,7 +414,7 @@ Validatable.prototype.isValid = function (callback, data) {
validationsDone.call(inst, function () {
if (valid && !asyncFail) cleanErrors(inst);
if (callback) {
callback(new ValidationError(this), valid && !asyncFail);
callback(valid ? null : new ValidationError(this), valid && !asyncFail);
}
});
}
Expand Down

0 comments on commit d6889e6

Please sign in to comment.