How to use the ember-validators/messages.present 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 poteto / ember-changeset-validations / addon / utils / messages.js View on Github external
import _Messages from 'ember-validators/messages';
import { assign } from '@ember/polyfills';
import { capitalize, dasherize } from '@ember/string';

const Messages = assign({}, _Messages);

export default assign(Messages, {
  // Blank and present are flipped in ember-validators. Need to flip them back here
  blank: _Messages.present,
  present: _Messages.blank,

  getDescriptionFor(key = '') {
    return capitalize(dasherize(key).split(/[_-]/g).join(' '));
  }
});