# stream-police

> block stream data on criteria

Latest version **2.0.0** (published 2015-12-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install stream-police
pnpm add stream-police
yarn add stream-police
bun add stream-police
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2015-12-11 |
| First published | 2013-07-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | jesse keane |
| Maintainers | jarofghosts |
| Keywords | stream, filter |

## Links

- npm: https://www.npmjs.com/package/stream-police
- Repository: https://github.com/jarofghosts/stream-police
- Homepage: https://github.com/jarofghosts/stream-police#readme
- Issues: https://github.com/jarofghosts/stream-police/issues
- npm.io page: https://npm.io/package/stream-police

## Dependencies (2)

- [nop](https://npm.io/package/nop.md) ^1.0.0
- [readable-stream](https://npm.io/package/readable-stream.md) ^2.0.4

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2015-12-11
- 1.0.0 — 2015-01-17
- 0.0.5 — 2014-02-23
- 0.0.3 — 2013-12-21
- 0.0.2 — 2013-08-21
- 0.0.1 — 2013-07-22
- 0.0.0 — 2013-07-22

## README

# stream-police

[![Build Status](http://img.shields.io/travis/jarofghosts/stream-police.svg?style=flat-square)](https://travis-ci.org/jarofghosts/stream-police)
[![npm install](http://img.shields.io/npm/dm/stream-police.svg?style=flat-square)](https://www.npmjs.org/package/stream-police)
[![npm version](https://img.shields.io/npm/v/stream-police.svg?style=flat-square)](https://www.npmjs.org/package/stream-police)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
[![License](https://img.shields.io/npm/l/stream-police.svg?style=flat-square)](https://github.com/jarofghosts/stream-police/blob/master/LICENSE)

Filter your streams.

## usage

`streamPolice(validateFunction[, streamOptions]) -> DuplexStream`

* For every chunk of data written to `DuplexStream`, 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
  `DuplexStream`

## example

```js
var police = require('stream-police')

var stream = police(isNaN)

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

or:

```js
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

---
_Source: https://npm.io/package/stream-police · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
