UNPKG

graphql-mocks

Version:

Tools for setting up graphql test resolvers

16 lines (14 loc) 739 B
'use strict'; var highlight = require('../highlight.js'); var reference = require('../highlighter/reference.js'); function coerceHighlight(schema, coercible) { if (coercible instanceof highlight.Highlight) return coercible; if (Array.isArray(coercible)) return new highlight.Highlight(schema).include(reference.reference(...coercible)); if (typeof coercible === 'function') { const h = new highlight.Highlight(schema); return coercible(h); } throw new Error(`Unable to coerce highlight, got ${typeof coercible}. Must be either an array of References, ` + `a callback that receives a Highlight instance, or a Highlight instance`); } exports.coerceHighlight = coerceHighlight; //# sourceMappingURL=coerce-highlight.js.map