UNPKG

graphql-mocks

Version:
30 lines (20 loc) 833 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var isTypeReference = require('./is-type-reference.js'); var isFieldReference = require('./is-field-reference.js'); function getTypeForReference(schema, reference) { if (isTypeReference.isTypeReference(reference)) { var _schema$getType; return (_schema$getType = schema.getType(reference)) !== null && _schema$getType !== void 0 ? _schema$getType : undefined; } if (isFieldReference.isFieldReference(reference)) { var _schema$getType2; const [typeName] = reference; return (_schema$getType2 = schema.getType(typeName)) !== null && _schema$getType2 !== void 0 ? _schema$getType2 : undefined; } return undefined; } exports.getTypeForReference = getTypeForReference; //# sourceMappingURL=get-type-for-reference.js.map