UNPKG

graphql-mocks

Version:
18 lines (13 loc) 683 B
import { Highlight } from '../highlight.js'; import { reference } from '../highlighter/reference.js'; function coerceHighlight(schema, coercible) { if (coercible instanceof Highlight) return coercible; if (Array.isArray(coercible)) return new Highlight(schema).include(reference(...coercible)); if (typeof coercible === 'function') { var h = new Highlight(schema); return coercible(h); } throw new Error("Unable to coerce highlight, got ".concat(typeof coercible, ". Must be either an array of References, ") + "a callback that receives a Highlight instance, or a Highlight instance"); } export { coerceHighlight }; //# sourceMappingURL=coerce-highlight.js.map