UNPKG

graphql-modules

Version:

Create reusable, maintainable, testable and extendable GraphQL modules

13 lines (12 loc) 429 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.gql = gql; const graphql_1 = require("graphql"); function gql(literals) { const result = typeof literals === 'string' ? literals : literals[0]; const parsed = (0, graphql_1.parse)(result); if (!parsed || parsed.kind !== graphql_1.Kind.DOCUMENT) { throw new Error('Not a valid GraphQL document.'); } return parsed; }