Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
inlineFragments.forEach(fragment => {
const fieldsAndTypeNames = getChildFields(fragment);
if (!fieldsAndTypeNames || !fieldsAndTypeNames.length) {
deleteInlineFragments(field, fragment);
filtered = true;
return;
}
if (fieldsAndTypeNames.length === 1) {
const { fieldNode } = fieldsAndTypeNames[0];
if (getName(fieldNode) === this._typeIDKey) {
deleteInlineFragments(field, fragment);
filtered = true;
}
}
});
inlineFragments.forEach(fragment => {
const fieldsAndTypeNames = getChildFields(fragment);
if (!fieldsAndTypeNames || !fieldsAndTypeNames.length) {
deleteInlineFragments(field, fragment);
filtered = true;
return;
}
if (fieldsAndTypeNames.length === 1) {
const { fieldNode } = fieldsAndTypeNames[0];
if (getName(fieldNode) === this._typeIDKey) {
deleteInlineFragments(field, fragment);
filtered = true;
}
}
});