stream-police
Filter your streams.
usage
streamPolice(validateFunction[, streamOptions]) -> DuplexStream
- For every chunk of data written to
DuplexStream
, it will be passed tovalidateFunction
which is expected to return a boolean value indicating whether the value should be emitted or not. streamOptions
is an optional argument that will be passed to instantiateDuplexStream
example
var police = var stream = stream // stream emits nothingstream // stream emits '!'
or:
var police = var stream = { return obj} stream // stream emits nothingstream // stream emits {cat: 'meow'}
license
MIT