Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.reduce((obj, x) => {
if (x.type.ofType) {
if (x.type.kind === 'LIST') {
obj[x.name] = [fakeField(x.type.ofType, typesMap)];
} else if (x.type.ofType.kind === 'SCALAR') {
obj[x.name] = fakeField(x.type.ofType, typesMap);
} else if (['INPUT_OBJECT', 'OBJECT'].includes(x.type.ofType.kind)) {
obj[x.name] = fakeMessage(typesMap[x.type.ofType.name], typesMap);
} else {
console.log('ignoreX', x);
}
} else if (x.type.kind === 'SCALAR') {
obj[x.name] = fakeField(x.type, typesMap);
}
return obj;
}, {});
.reduce((obj, x) => {
if (x.type.ofType) {
if (x.type.kind === 'LIST') {
obj[x.name] = [fakeField(x.type.ofType, typesMap)];
} else if (x.type.ofType.kind === 'SCALAR') {
obj[x.name] = fakeField(x.type.ofType, typesMap);
} else if (['INPUT_OBJECT', 'OBJECT'].includes(x.type.ofType.kind)) {
obj[x.name] = fakeMessage(typesMap[x.type.ofType.name], typesMap);
} else {
console.log('ignoreX', x);
}
} else if (x.type.kind === 'SCALAR') {
obj[x.name] = fakeField(x.type, typesMap);
}
return obj;
}, {});
.reduce((obj, x) => {
if (x.type.ofType) {
if (x.type.kind === 'LIST') {
obj[x.name] = [fakeField(x.type.ofType, typesMap)];
} else if (x.type.ofType.kind === 'SCALAR') {
obj[x.name] = fakeField(x.type.ofType, typesMap);
} else if (['INPUT_OBJECT', 'OBJECT'].includes(x.type.ofType.kind)) {
obj[x.name] = fakeMessage(typesMap[x.type.ofType.name], typesMap);
} else {
console.log('ignoreX', x);
}
} else if (x.type.kind === 'SCALAR') {
obj[x.name] = fakeField(x.type, typesMap);
}
return obj;
}, {});