Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getAliasDirective(field: FieldDefinitionNode) {
const alias = (field.directives || []).find(dir => dir.name.value === 'jsonAlias')
if (!alias) {
return null
}
const forArg = (alias.arguments || []).find(arg => arg.name.value === 'for')
if (!forArg) {
return null
}
return valueFromAST(forArg.value, GraphQLString, {})
}
function getJsonAliasTargets(field: FieldDefinitionNode) {
const alias = (field.directives || []).find(dir => dir.name.value === 'jsonAlias')
if (!alias) {
return null
}
const forArg = (alias.arguments || []).find(arg => arg.name.value === 'for')
if (!forArg) {
return null
}
return valueFromAST(forArg.value, GraphQLString, {})
}
function getJsonAliasTargets(field: FieldDefinitionNode) {
const alias = (field.directives || []).find(dir => dir.name.value === 'jsonAlias')
if (!alias) {
return null
}
const forArg = (alias.arguments || []).find(arg => arg.name.value === 'for')
if (!forArg) {
return null
}
return valueFromAST(forArg.value, GraphQLString, {})
}