UNPKG

graphql-paper

Version:

A flexible in-memory store based on a GraphQL Schema

15 lines (13 loc) 479 B
'use strict'; var allDocuments = require('./all-documents.js'); var getDocumentKey = require('../document/get-document-key.js'); function findDocument(data, key) { if (typeof key !== 'string') { key = getDocumentKey.getDocumentKey(key); } const all = allDocuments.allDocuments(data); const found = all.find(document => getDocumentKey.getDocumentKey(document) === key); return found; } exports.findDocument = findDocument; //# sourceMappingURL=find-document.js.map