Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

whitelist / blacklist the properties of objects being passed down a stream

Notifications You must be signed in to change notification settings

pelias-deprecated/prop-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

$ npm install prop-stream

NPM

Usage

You can control which properties may exist on objects passing through an obj stream with a whitelist:

var through = require('through2'),
    stream = require('prop-stream');

// set up a pipeline
var pip = stream.whitelist( [ 'id', 'name', 'hat_size' ] )
  .pipe( through.obj( function( chunk, enc, next ){
    console.log( Object.keys( chunk ) );
    next();
  }));

// the 'arms' property will now be `deleted` from the object.
pip.write( { id: 1, name: 'peter', hat_size: 'medium', arms: 2 } );

There is also a blacklist which does the opposite.

NPM Module

The prop-stream npm module can be found here:

https://npmjs.org/package/prop-stream

Contributing

Please fork and pull request against upstream master on a feature branch.

Pretty please; provide unit tests and script fixtures in the test directory.

Running Unit Tests

$ npm test

Continuous Integration

Travis tests every release against node version 0.10

Build Status

About

whitelist / blacklist the properties of objects being passed down a stream

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published