@graphql-markdown/utils
Advanced tools
Comparing version 1.1.4 to 1.2.0
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.1.4", | ||
"version": "1.2.0", | ||
"license": "MIT", | ||
@@ -11,0 +11,0 @@ "main": "src/index.js", |
@@ -159,7 +159,7 @@ const { | ||
function hasDirective(type, directiveName) { | ||
function hasDirective(type, directives) { | ||
if ( | ||
typeof type.astNode === "undefined" || | ||
type.astNode == null || | ||
typeof directiveName !== "string" || | ||
typeof directives === "undefined" || | ||
!Array.isArray(type.astNode.directives) | ||
@@ -170,5 +170,7 @@ ) { | ||
const directiveList = Array.isArray(directives) ? directives : [directives]; // backward_compatibility | ||
return ( | ||
type.astNode.directives.findIndex( | ||
(directive) => directive.name.value === directiveName, | ||
type.astNode.directives.findIndex((directive) => | ||
directiveList.includes(directive.name.value), | ||
) > -1 | ||
@@ -361,2 +363,10 @@ ); | ||
function isDeprecated(type) { | ||
return ( | ||
(hasProperty(type, "isDeprecated") && type.isDeprecated === true) || | ||
(hasProperty(type, "deprecationReason") && | ||
typeof type.deprecationReason === "string") | ||
); | ||
} | ||
module.exports = { | ||
@@ -383,2 +393,3 @@ loadSchema, | ||
isListType, | ||
isDeprecated, | ||
printSchema, | ||
@@ -385,0 +396,0 @@ getIntrospectionFieldsList, |
16314
507