Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function getMessages(moduleMap = requirejs.entries, useCache = true) {
let messagesModule = defaultMessages;
if (useCache && isPresent(cachedRef)) {
return cachedRef;
}
let moduleKey = emberArray(keys(moduleMap))
.find((key) => key === moduleName);
if (isPresent(moduleKey)) {
// Merge the user specified messages with the defaults
messagesModule = withDefaults(requireModule(moduleKey).default, messagesModule);
}
cachedRef = messagesModule;
return messagesModule;
}
export default function validateLength(options = {}) {
options = withDefaults(options, { useBetweenMessage: true });
return (key, value) => {
let result = validate('length', value, options, null, key);
return (result === true) ? true : buildMessage(key, result);
};
}
export default function validateNumber(options = {}) {
options = withDefaults(options, { allowString: true, allowNone: false });
if (options.allowBlank) {
options.allowNone = true;
}
return (key, value) => {
let result = validate('number', value, options, null, key);
return (result === true) ? true : buildMessage(key, result);
};
}