Get attributes of GraphQL queries
const { parse } = require('graphql-attr');
parse('query { email }').isMutation() // → false
parse('query { email }').isQuery() // → true
const { parse } = require('graphql-attr');
parse('query { email }').containsField('email') // → true
const { parse } = require('graphql-attr');
const query = 'query { robot(name: "wall-e") { name } }'
parse(query).containsArg('name') // → true
parse(query).containsArg('name', 'wall-e') // → true
parse(query).containsArg('name', 'banana') // → false
parse(query).containsArg('material') // → false
MIT