INNER CODE UNIT · JavaScript
first
sheerun/graphqlviz · cli.js:163
const first = text.match(/[^\s]/)
if (!first) {
throw new Error('No text to parse')
}
if (first[0] === "{") {
try {
returnedPromise = Promise.resolve(JSON.parse(text))
} catch (e) {
fatal(e, text)
}
} else {
returnedPromise = introspect(text)
}
return returnedPromise
})
introspectionPromise.then(function (executionResult) {
// undocumented outputJSON can be used to convert graphql schema to JSON (useful for generating test data)