UNPKG

@graphql-tools/batch-delegate

Version:

A set of utils for faster development of GraphQL tools

13 lines (12 loc) 361 B
import { getLoader } from './getLoader.js'; export function batchDelegateToSchema(options) { const key = options.key; if (key == null) { return null; } else if (Array.isArray(key) && !key.length) { return []; } const loader = getLoader(options); return Array.isArray(key) ? loader.loadMany(key) : loader.load(key); }