UNPKG

graphql-mocks

Version:
23 lines (16 loc) 699 B
import { isTypeReference } from './is-type-reference.js'; import { isFieldReference } from './is-field-reference.js'; function getTypeForReference(schema, reference) { if (isTypeReference(reference)) { var _schema$getType; return (_schema$getType = schema.getType(reference)) !== null && _schema$getType !== void 0 ? _schema$getType : undefined; } if (isFieldReference(reference)) { var _schema$getType2; var [typeName] = reference; return (_schema$getType2 = schema.getType(typeName)) !== null && _schema$getType2 !== void 0 ? _schema$getType2 : undefined; } return undefined; } export { getTypeForReference }; //# sourceMappingURL=get-type-for-reference.js.map