import * as through from 'through2' ; import { SanityDocument } from '../types/sanity' ; import { isDraftId } from './documentIds' ; function filter ( doc , enc , callback ) { return isDraft ( doc ) ? callback ( ) : callback ( null , doc ) ; } function isDraft ( doc ) { return doc && doc . _id && isDraftId ( doc . _id ) ; } export const removeDrafts = ( ) => through . obj ( filter ) ;