How to use the ember-validators/utils/is-promise function in ember-validators

To help you get started, we’ve selected a few ember-validators examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github offirgolan / ember-validators / addon / has-many.js View on Github external
export default function validateHasMany(value) {
  if (value) {
    if (isPromise(value)) {
      return value.then(models => models ? models.map(m => m.get('validations')) : true);
    }
    return value.map(m => m.get('validations'));
  }

  return true;
}
github offirgolan / ember-validators / addon / belongs-to.js View on Github external
export default function validateBelongsTo(value) {
  if (value) {
    if (isPromise(value)) {
      return value.then(model => model ? get(model, 'validations') : true);
    }
    return get(value, 'validations');
  }

  return true;
}