@graphql-tools/wrap
Version:
A set of utils for faster development of GraphQL tools
13 lines (12 loc) • 603 B
JavaScript
import { valueMatchesCriteria } from '@graphql-tools/utils';
import FilterObjectFieldDirectives from './FilterObjectFieldDirectives.js';
export default class RemoveObjectFieldDirectives {
constructor(directiveName, args = {}) {
this.transformer = new FilterObjectFieldDirectives((dirName, dirValue) => {
return !(valueMatchesCriteria(dirName, directiveName) && valueMatchesCriteria(dirValue, args));
});
}
transformSchema(originalWrappingSchema, subschemaConfig) {
return this.transformer.transformSchema(originalWrappingSchema, subschemaConfig);
}
}