$ npm install prop-stream
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.
The prop-stream
npm module can be found here:
https://npmjs.org/package/prop-stream
Please fork and pull request against upstream master on a feature branch.
Pretty please; provide unit tests and script fixtures in the test
directory.
$ npm test
Travis tests every release against node version 0.10