How to use the ember-changeset-validations/utils/validation-errors 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 / validators / presence.js View on Github external
return true;
    }

    let result = validate('presence', value, options, null, key);

    if (typeof result === 'boolean' || typeof result === 'string') {
      return result;
    } else {
      // We flipped the meaning behind `present` and `blank` so switch the two
      if (result.type === 'present') {
        result.type = 'blank';
      } else if (result.type === 'blank') {
        result.type = 'present';
      }

      return buildMessage(key, result);
    }
  };
}
github NYCPlanning / labs-zap-search / app / validators / presence-unless-value.js View on Github external
}
    }

    const result = validate('presence', value, options, null, key);

    if (typeof result === 'boolean' || typeof result === 'string') {
      return result;
    }
    // We flipped the meaning behind `present` and `blank` so switch the two
    if (result.type === 'present') {
      result.type = 'blank';
    } else if (result.type === 'blank') {
      result.type = 'present';
    }

    return buildMessage(key, result);
  };
}
github poteto / ember-changeset-validations / addon / validators / exclusion.js View on Github external
return (key, value) => {
    let result = validate('exclusion', value, options, null, key);
    return (result === true) ? true : buildMessage(key, result);
  };
}
github poteto / ember-changeset-validations / addon / validators / format.js View on Github external
return (key, value) => {
    if (!hasOptions) {
      return true;
    }

    let result = validate('format', value, options, null, key);
    return (result === true) ? true : buildMessage(key, result);
  };
}
github poteto / ember-changeset-validations / addon / validators / inclusion.js View on Github external
return (key, value) => {
    let result = validate('inclusion', value, options, null, key);
    return (result === true) ? true : buildMessage(key, result);
  };
}
github poteto / ember-changeset-validations / addon / validators / number.js View on Github external
return (key, value) => {
    let result = validate('number', value, options, null, key);
    return (result === true) ? true : buildMessage(key, result);
  };
}
github poteto / ember-changeset-validations / addon / validators / confirmation.js View on Github external
return (key, newValue, _oldValue, changes/*, _content*/) => {
    let result = validate('confirmation', newValue, options, changes, key);
    return (result === true) ? true : buildMessage(key, result);
  };
}
github nano-wallet-company / nano-wallet-desktop / app / validators / mnemonic.js View on Github external
return (key, newValue) => {
    const isValid = bip39.validateMnemonic(newValue);
    return isValid || buildMessage(key, { type: 'invalid' }, newValue, options);
  };
}
github poteto / ember-changeset-validations / addon / validators / length.js View on Github external
return (key, value) => {
    let result = validate('length', value, options, null, key);
    return (result === true) ? true : buildMessage(key, result);
  };
}