UNPKG

subtitle

Version:

Stream-based library for parsing and manipulating subtitles

12 lines (10 loc) 308 B
import { Node } from '.' import { Transform } from 'stream' export const filter = (callback: (node: Node) => boolean) => new Transform({ objectMode: true, autoDestroy: false, transform: function transform(chunk, _encoding, next) { callback(chunk) ? next(null, chunk) : next() } })