message: Validator.validate always returns a promise fix
diff: @@ -54,7 +54,6 @@ export default class Validator
  }
  Rules[name] = validator.validate;
  -
  if (validator.getMessage && isCallable(validator.getMessage)) {
  dictionary.setMessage('en', name, validator.getMessage);
  }
  @@ -689,8 +688,7 @@ export default class Validator
  * @param {string} name the field name.
  * @param {*} value The value to be validated.
  * @param {String} scope The scope of the field.
  - * @return {boolean|Promise} result returns a boolean or a promise that will resolve to
  - * a boolean.
  + * @return {Promise}
  */
  validate(name, value, scope = '__global__') {
  if (name && name.indexOf('.') > -1) {
  @@ -701,11 +699,12 @@ export default class Validator
  }
  if (! scope) scope = '__global__';
  if (! this.$scopes[scope] || ! this.$scopes[scope][name]) {
  - if (! this.strictMode) { return true; }
  + if (! this.strictMode) return Promise.resolve(true);
  +
  const fullName = scope === '__global__' ? name : `${scope}.${name}`;
  warn(`Validating a non-existant field: "${fullName}". Use "attach()" first.`);
  - return false;
  + return Promise.reject(false);
  }
  const field = this.$scopes[scope][name];
  @@ -713,7 +712,7 @@ export default class Validator
  // if its not required and is empty or null or undefined then it passes.
  if (! field.required && ~[null, undefined, ''].indexOf(value)) {
  this.fieldBag._setFlags(name, { valid: true, dirty: true });
  - return true;
  + return Promise.resolve(true);
  }
  const promises = [];
  @@ -742,7 +741,14 @@ export default class Validator
  this.fieldBag._setFlags(name, { valid: test, dirty: true });
  - return test;
  + return new Promise((resolve, reject) => {
  + if (test) {
  + resolve(test)
  + return
  + }
  +
  + reject(false);
  + });
  }
  /**
  @@ -764,30 +770,16 @@ export default class Validator
  });
  }
  - let test = true;
  - const promises = [];
  - Object.keys(normalizedValues).forEach(property => {
  - const result = this.validate(
  + const promises = Object.keys(normalizedValues).map(property => {
  + return this.validate(
  property,
  normalizedValues[property].value,
  normalizedValues[property].scope
  );
  - if (isCallable(result.then)) {
  - promises.push(result);
  - return;
  - }
  -
  - test = test && result;
  });
  - return Promise.all(promises).then(vals => {
  - const valid = vals.every(t => t) && test;
  -
  - if (! valid) {
  + return Promise.all(promises).then(() => true).catch(() => {
  throw new ValidatorException('Validation Failed');
  - }
  -
  - return valid;
  });
  }
  