UNPKG

graphql-mocks

Version:
25 lines (17 loc) 810 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); 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