How to use the ember-changeset-validations/utils/handle-multiple-validations function in ember-changeset-validations

To help you get started, we’ve selected a few ember-changeset-validations 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 poteto / ember-changeset-validations / addon / index.js View on Github external
return ({ key, newValue, oldValue, changes, content }) => {
    let validator = validationMap[key];

    if (isEmpty(validator)) {
      return true;
    }

    if (isArray(validator)) {
      return handleMultipleValidations(validator, { key, newValue, oldValue, changes, content });
    }

    let validation = validator(key, newValue, oldValue, changes, content);

    return isPromise(validation) ? validation.then(wrapInArray) : [validation];
  };
}