import { DocumentNode, Kind } from 'graphql/language';
import { gql } from '../';

export const isDirectiveDefined = (
  typeDefs: DocumentNode[] | string,
  directiveName: string,
): boolean => {
  if (typeof typeDefs === 'string') {
    return isDirectiveDefined([gql(typeDefs)], directiveName);
  }
  return typeDefs.some(typeDef =>
    Object.prototype.hasOwnProperty.call(typeDef, 'definitions')
      ? typeDef.definitions.some(
          definition =>
            definition.kind === Kind.DIRECTIVE_DEFINITION &&
            definition.name.value === directiveName,
        )
      : false,
  );
};

import { DocumentNode, Kind } from 'graphql/language';
import { gql } from '../';

export const isDirectiveDefined = (
  typeDefs: DocumentNode[] | string,
  directiveName: string,
): boolean => {
  if (typeof typeDefs === 'string') {
    return isDirectiveDefined([gql(typeDefs)], directiveName);
  }
  return typeDefs.some(typeDef =>
    typeDef.hasOwnProperty('definitions')
      ? typeDef.definitions.some(
          definition =>
            definition.kind === Kind.DIRECTIVE_DEFINITION &&
            definition.name.value === directiveName,
        )
      : false,
  );
};

--- 
+++ 
@@ -9,7 +9,7 @@
     return isDirectiveDefined([gql(typeDefs)], directiveName);
   }
   return typeDefs.some(typeDef =>
-    typeDef.hasOwnProperty('definitions')
+    Object.prototype.hasOwnProperty.call(typeDef, 'definitions')
       ? typeDef.definitions.some(
           definition =>
             definition.kind === Kind.DIRECTIVE_DEFINITION &&
Use `Object.prototype.hasOwnProperty.call` to be extra defensive.
