UNPKG

@graphql-mesh/fusion-execution

Version:
11 lines (10 loc) 332 B
import { parse, print } from 'graphql'; const printCache = new WeakMap(); export function parseAndCache(source) { const parsed = parse(source, { noLocation: true }); printCache.set(parsed, source); return parsed; } export function printCached(document) { return printCache.get(document) || print(document).trim(); }