Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createErrorMessage(type, value, options = {}) {
let messages = this.get('errorMessages');
let message = unwrapString(get(options, 'message'));
set(
options,
'description',
messages.getDescriptionFor(get(this, 'attribute'), options)
);
if (message) {
if (typeof message === 'string') {
message = messages.formatMessage(message, options);
} else if (typeof message === 'function') {
message = message.apply(this, arguments);
message = isNone(message)
? messages.getMessageFor(type, options)
: messages.formatMessage(message, options);
}