Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
f.type.options && f.type.options.find((o) => o === Options.array) ? `[${type}]` : type
/**
f.type.options.find((o) => o === Options.array)
? `${type}!`
import { Instances, Options } from 'graphql-zeus';
import { EditorNodeDefinition } from '../../Models';
import { help } from './help';
export const ArgumentInstance: Partial & Pick = {
node: {
notEditable: true,
name: undefined,
},
data: {
type: Instances.Argument,
},
options: [
{
name: Options.array,
help: help.array,
},
],
};
static resolve(f: ParserField) {
let argsString = '';
if (f.args && f.args.length) {
if (f.type.options && f.type.options.includes(Options.array)) {
argsString = ` = [${f.args.map(TemplateUtils.resolverForConnection).join(',\n')}]`;
} else {
argsString = ` = ${f.args.map(TemplateUtils.resolverForConnection).join('\n')}`;
}
}
return `${TemplateUtils.descriptionResolver(f.description, `\t`)}\t${
f.name
} : ${TemplateUtils.resolveType(f)}${argsString}${TemplateUtils.resolveDirectives(
f.directives
)}`;
}
}
static resolve(f: ParserField) {
let argsString = '';
if (f.args && f.args.length) {
if (f.type.options && f.type.options!.includes(Options.array)) {
argsString = `[${f.args.map(TemplateUtils.resolverForConnection).join(',\n')}]`;
} else {
argsString = `${f.args.map(TemplateUtils.resolverForConnection).join('\n')}`;
}
}
return `${f.type.name} : ${argsString}`;
}
}
array: f.type.options && !!f.type.options.find((o) => o === Options.array),
required: f.type.options && !!f.type.options.find((o) => o === Options.required),