UNPKG

gatsby-source-sanity

Version:

Gatsby source plugin for building websites using Sanity.io as a backend.

22 lines 717 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var through = require("through2"); var documentIds_1 = require("./documentIds"); function filter(doc, enc, callback) { return isDraft(doc) ? callback() : callback(null, doc); } function isDraft(doc) { return doc && doc._id && documentIds_1.isDraftId(doc._id); } exports.isDraft = isDraft; exports.removeDrafts = function () { return through.obj(filter); }; exports.extractDrafts = function (target) { return through.obj(function (doc, enc, callback) { if (!isDraft(doc)) { return callback(null, doc); } target.push(doc); callback(); }); }; //# sourceMappingURL=handleDrafts.js.map