UNPKG

graphbrainz

Version:

A GraphQL schema, Express server, and middleware for querying the MusicBrainz.

18 lines (15 loc) 641 B
/** * This module only exists because as of this writing, `graphql-tag` doesn't * support type, field, or argument descriptions. That's a bummer, so this * simple tag is provided instead. It doesn't support any type of interpolation * whatsoever, but will parse the GraphQL document, allow syntax highlighting, * and enable Prettier formatting. */ import GraphQL from 'graphql'; const { parse } = GraphQL; export default function gql(literals, ...interpolations) { if (literals.length !== 1 || interpolations.length) { throw new Error('The gql template tag does not support interpolation.'); } return parse(literals[0]); }