Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
well i cant tell lies cuz theyre listening to me
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

stream-police

Build Status npm install

filter your streams.

usage

streamPolice(validateFunction[, streamOptions]) -> TransformStream

  • For every chunk of data written to TransformStream, it will be passed to validateFunction 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 instantiate TransformStream

example

var police = require('stream-police')

var stream = police(isNaN)

stream.write('5') // stream emits nothing
stream.write('!') // stream emits '!'

or:

var police = require('stream-police')

var stream = police(hasCat, {objectMode: true})

function hasCat(obj) {
  return obj.hasOwnProperty('cat')
}

stream.write({dog: 'woof'}) // stream emits nothing
stream.write({cat: 'meow'}) // stream emits {cat: 'meow'}

license

MIT

Something went wrong with that request. Please try again.