make-prop-stream

1.0.0 • Public • Published

make-prop-stream

Takes in values and outputs objects with that value under a given property. This is useful for transforming a stream of events into objects that might be useful for a consumer down the pipe.

Installing

npm install --save make-prop-stream

API

MakePropStream(prop)

parameters

  • prop (String): Which property to output the data under

returns

(Stream): Duplex objectMode stream with all the created objects

Example

var StreamArray = require("stream-array");
var stdout = require("stdout")();
var MakePropStream = require("make-prop-stream");
 
var names = ["bob", "joel", "anne", "meadow"];
 
StreamArray(names)
  .pipe(MakePropStream("name"))
  .pipe(stdout);
 
/* Should output
{ name: 'bob' }
{ name: 'joel' }
{ name: 'anne' }
{ name: 'meadow' }
*/

Package Sidebar

Install

npm i make-prop-stream

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • rangermauve