Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* globals requirejs, requireModule */
import { A as emberArray } from '@ember/array';
import { isPresent } from '@ember/utils';
import config from 'ember-get-config';
import defaultMessages from 'ember-changeset-validations/utils/messages';
import withDefaults from 'ember-changeset-validations/utils/with-defaults';
const { keys } = Object;
const moduleName = `${config.modulePrefix}/validations/messages`;
let cachedRef = null;
/**
* Find and load messages module on consuming app. Defaults to addon messages.
* To define a custom message map, create `my-app/app/validations/messages.js`
* and export an object.
*
* @param {Object} moduleMap
* @param {Boolean} useCache Pass `false` to ignore cached key
* @return {Object}
*/
export default function getMessages(moduleMap = requirejs.entries, useCache = true) {
let messagesModule = defaultMessages;
if (useCache && isPresent(cachedRef)) {
export default function gatherModules(subRoute) {
const modulePrefix = config.modulePrefix;
const paths = Object.keys(requirejs.entries);
const regexp = new RegExp(`${modulePrefix}\/${subRoute}\/(.*)`);
return paths.filter((path) => {
return regexp.test(path);
}).reduce((modules, path) => {
const moduleName = regexp.exec(path)[1];
const module = requirejs(`${modulePrefix}\/${subRoute}\/${moduleName}`).default;
modules.set(moduleName, module);
return modules;
}, new Map());
}
Object.keys(config.bundles).forEach((key)=>{
if(bundleMapKey.indexOf(key) > -1){
config.bundles[key].url = jsonObj[key];
}else {
return '/assets/' + config.modulePrefix + "." + key + '.bundle.js';
}
});
genericModuleNameLookupPatterns.forEach(function(genericLookupPattern) {
packageNames.concat(config.modulePrefix).forEach(function(packageName) {
lookupFunctions.push(function(parsedName) {
return genericLookupPattern.call(this, packageName, parsedName);
});
});
});
.map((module) => {
return module
.replace(`${config.modulePrefix}/models/`, '')
.replace(`${config.podModulePrefix}/models/`, '')
})
.indexOf(modelName) !== -1