Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Object.keys(moduleMap).forEach(function(moduleType) {
var filePaths = moduleMap[moduleType];
if (filePaths.length < 1) {
return;
}
contents += ' // ' + changeCase.ucFirst(moduleType) + 's\n';
filePaths.forEach(function(file) {
var moduleName = file.name;
var modulePath = file.path.replace('\\', '/');
contents += ' app.' + moduleType + '(';
// precede animations with a `.`
if (moduleType === 'animation') {
moduleName = '.' + moduleName;
}
// config modules don't have a name
if (moduleType !== 'config') {
contents += '\'' + moduleName + '\', ';
}
get typeName() {
let typeName: string;
if (isOperation(this.operation)) {
const {operationName, operationType} = this.operation;
typeName = `${ucFirst(operationName)}${ucFirst(operationType)}Data`;
} else {
const {fragmentName} = this.operation;
typeName = `${ucFirst(fragmentName)}FragmentData`;
}
return this.options.partial
? typeName.replace(/Data$/, 'PartialData')
: typeName;
}
function exportTransformation(name) {
var f = changeCase[name];
module.exports[name + 'Keys'] = makeObjectTransformation(f);
module.exports[name + 'Array'] = makeArrayTransformation(f);
module.exports['to' + changeCase.ucFirst(name)] = makeArbitraryDataTransformation(f);
}
function exportTransformation(name) {
var f = changeCase[name];
module.exports[name + 'Keys'] = makeObjectTransformation(f);
module.exports[name + 'Array'] = makeArrayTransformation(f);
module.exports['to' + changeCase.ucFirst(name)] = makeArbitraryDataTransformation(f);
}
get typeName() {
let typeName: string;
if (isOperation(this.operation)) {
const {operationName, operationType} = this.operation;
typeName = `${ucFirst(operationName)}${ucFirst(operationType)}Data`;
} else {
const {fragmentName} = this.operation;
typeName = `${ucFirst(fragmentName)}FragmentData`;
}
return this.options.partial
? typeName.replace(/Data$/, 'PartialData')
: typeName;
}
get name(): string {
const {parent, field, isFragment, type} = this;
const fieldName = field ? ucFirst(field.responseName) : '';
const name = `${parent ? parent.name : ''}${fieldName}`;
return isFragment ? `${name}${type ? type.name : 'Other'}` : name;
}