@graphql-tools/optimize
Version:
A set of utils for faster development of GraphQL tools
20 lines (19 loc) • 546 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeLoc = void 0;
const graphql_1 = require("@graphql-tools/graphql");
/**
* This optimizer removes "loc" fields
* @param input
*/
const removeLoc = input => {
function transformNode(node) {
if (node.loc && typeof node.loc === 'object') {
const { loc, ...rest } = node;
return rest;
}
return node;
}
return (0, graphql_1.visit)(input, { enter: transformNode });
};
exports.removeLoc = removeLoc;