@graphql-tools/mock
Version:
A set of utils for faster development of GraphQL tools
12 lines (11 loc) • 365 B
JavaScript
export function isRef(maybeRef) {
return !!(maybeRef && typeof maybeRef === 'object' && '$ref' in maybeRef);
}
export function assertIsRef(maybeRef, message) {
if (!isRef(maybeRef)) {
throw new Error(message || `Expected ${maybeRef} to be a valid Ref.`);
}
}
export function isRecord(obj) {
return typeof obj === 'object' && obj !== null;
}