@graphql-markdown/utils
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"license": "MIT", | ||
@@ -11,0 +11,0 @@ "main": "src/index.js", |
@@ -25,5 +25,10 @@ const { hasProperty, isEmpty } = require("./object"); | ||
const directiveOptions = getCustomDirectiveOptions( | ||
schemaDirectiveName, | ||
customDirectiveOptions, | ||
); | ||
customDirectives[schemaDirectiveName] = { | ||
type: schemaDirectives[schemaDirectiveName], | ||
descriptor: getDescriptor(schemaDirectiveName, customDirectiveOptions), | ||
...directiveOptions, | ||
}; | ||
@@ -35,12 +40,15 @@ } | ||
function getDescriptor(schemaDirectiveName, customDirectiveOptions) { | ||
function getCustomDirectiveOptions( | ||
schemaDirectiveName, | ||
customDirectiveOptions, | ||
) { | ||
if (hasProperty(customDirectiveOptions, schemaDirectiveName) === true) { | ||
return customDirectiveOptions[schemaDirectiveName].descriptor; | ||
return customDirectiveOptions[schemaDirectiveName]; | ||
} | ||
if (hasProperty(customDirectiveOptions, WILDCARD_DIRECTIVE) === true) { | ||
return customDirectiveOptions[WILDCARD_DIRECTIVE].descriptor; | ||
return customDirectiveOptions[WILDCARD_DIRECTIVE]; | ||
} | ||
return undefined; | ||
return {}; | ||
} | ||
@@ -55,2 +63,6 @@ | ||
module.exports = { getCustomDirectives, getDescriptor, isCustomDirective }; | ||
module.exports = { | ||
getCustomDirectives, | ||
getCustomDirectiveOptions, | ||
isCustomDirective, | ||
}; |
@@ -16,2 +16,9 @@ const { getTypeDirectiveValues } = require("./graphql"); | ||
module.exports = { directiveDescriptor }; | ||
function directiveTag(directiveType, type, classname = "badge--secondary") { | ||
return { | ||
text: `@${directiveType.name}`, | ||
classname: classname, | ||
}; | ||
} | ||
module.exports = { directiveDescriptor, directiveTag }; |
@@ -12,2 +12,3 @@ module.exports = { | ||
helper: require("./helper"), | ||
logger: require("./logger"), | ||
}; |
@@ -7,4 +7,6 @@ /** | ||
return ( | ||
!!(obj && obj[prop]) || | ||
(obj instanceof Object && Object.prototype.hasOwnProperty.call(obj, prop)) | ||
typeof obj === "object" && | ||
(!!(obj && obj[prop]) || | ||
(obj instanceof Object && | ||
Object.prototype.hasOwnProperty.call(obj, prop))) | ||
); | ||
@@ -18,3 +20,3 @@ } | ||
function isEmpty(obj) { | ||
return typeof obj !== "object" || Object.keys(obj).length === 0; | ||
return typeof obj !== "object" || !Object.keys(obj).length; | ||
} | ||
@@ -31,2 +33,7 @@ | ||
module.exports = { hasMethod, hasProperty, isEmpty, getObjPath }; | ||
module.exports = { | ||
getObjPath, | ||
hasMethod, | ||
hasProperty, | ||
isEmpty, | ||
}; |
/* istanbul ignore file */ | ||
const logger = require("./logger").getInstance(); | ||
function prettify(content, parser) { | ||
@@ -8,3 +10,3 @@ try { | ||
} catch (error) { | ||
console.debug("Prettier is not found"); | ||
logger.warn("Prettier is not found"); | ||
} | ||
@@ -11,0 +13,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23031
15
724
4