function UniqueDirectivesPerLocation(context) {
  return {
    // Many different AST nodes may contain directives. Rather than listing
    // them all, just listen for entering any node, and check to see if it
    // defines any directives.
    enter: function enter(node) {
      if (node.directives) {
        var knownDirectives = Object.create(null);
        node.directives.forEach(function (directive) {
          var directiveName = directive.name.value;
          if (knownDirectives[directiveName]) {
            context.reportError(new _error.GraphQLError(duplicateDirectiveMessage(directiveName), [knownDirectives[directiveName], directive]));
          } else {
            knownDirectives[directiveName] = directive;
          }
        });
      }
    }
  };
}
/**
 * Unique directive names per location
 *
 * A GraphQL document is only valid if all directives at a given location
 * are uniquely named.
 */
Unique directive names per location
A GraphQL document is only valid if all directives at a given location
are uniquely named.
Unique directive names per location A GraphQL document is only valid if all directives at a given location are uniquely named .
function UniqueDirectivesPerLocation(context) {
  return {
    enter: function enter(node) {
      if (node.directives) {
        var knownDirectives = Object.create(null);
        node.directives.forEach(function (directive) {
          var directiveName = directive.name.value;
          if (knownDirectives[directiveName]) {
            context.reportError(new _error.GraphQLError(duplicateDirectiveMessage(directiveName), [knownDirectives[directiveName], directive]));
          } else {
            knownDirectives[directiveName] = directive;
          }
        });
      }
    }
  };
}
function UniqueDirectivesPerLocation ( context ) { return { enter : function enter ( node ) { if ( node . directives ) { var knownDirectives = Object . create ( null ) ; node . directives . forEach ( function ( directive ) { var directiveName = directive . name . value ; if ( knownDirectives [ directiveName ] ) { context . reportError ( new _error . GraphQLError ( duplicateDirectiveMessage ( directiveName ) , [ knownDirectives [ directiveName ] , directive ] ) ) ; } else { knownDirectives [ directiveName ] = directive ; } } ) ; } } } ; }
Unique directive names per location
 A GraphQL document is only valid if all directives at a given location
 are uniquely named.
Unique directive names per location A GraphQL document is only valid if all directives at a given location are uniquely named .
// Many different AST nodes may contain directives. Rather than listing // them all, just listen for entering any node, and check to see if it // defines any directives.