Skip to content
This repository
Browse code

Fix validations

  • Loading branch information...
commit 6449f1ca72dfe7c3f2c15391089f368d19a2e7ad 1 parent 0776c51
Anatoliy Chakkaev authored

Showing 1 changed file with 10 additions and 3 deletions. Show diff stats Hide diff stats

  1. +10 3 lib/validations.js
13 lib/validations.js
@@ -374,15 +374,22 @@ Validatable.prototype.isValid = function (callback, data) {
374 374 });
375 375
376 376 if (!async) {
377   - validationsDone.call(inst, callback);
  377 + validationsDone.call(inst, function() {
  378 + if (valid) cleanErrors(inst);
  379 + if (callback) {
  380 + callback(valid);
  381 + }
  382 + });
378 383 }
379 384
380 385 function done(fail) {
381 386 asyncFail = asyncFail || fail;
382   - if (--wait === 0 && callback) {
  387 + if (--wait === 0) {
383 388 validationsDone.call(inst, function () {
384 389 if (valid && !asyncFail) cleanErrors(inst);
385   - callback(valid && !asyncFail);
  390 + if (callback) {
  391 + callback(valid && !asyncFail);
  392 + }
386 393 });
387 394 }
388 395 }

0 comments on commit 6449f1c

Please sign in to comment.
Something went wrong with that request. Please try again.