Big News: Socket Selected for OpenAI's Cybersecurity Grant Program.Details
Socket
Book a DemoSign in
Socket

conditional-stream

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

conditional-stream

A duplex stream that only passes data through when a set function returns true

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
6
200%
Maintainers
1
Weekly downloads
 
Created
Source

conditional-stream

conditional-stream is a duplex stream that only passes data when a set function returns true

build status

requirements

  • node v0.10+ (this uses streams2)

install

  • npm install conditional-stream

example

to filter/limit a stream to only numbers

onlyNumbers.js

var CondStream = require('conditional-stream')
  , cond = new CondStream(function(input) {
  return (!isNaN(Number(input.toString())))
})

process.stdin.pipe(cond).pipe(process.stdout)

console

> echo 2 | node onlyNumbers.js
2

> echo a | node onlyNumbers.js
>

license

MIT

Keywords

streams2

FAQs

Package last updated on 20 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts