0.0.2 • Published 10 years ago

to-stream v0.0.2

Weekly downloads
10
License
MIT
Repository
github
Last release
10 years ago

to-stream

Build Status

Turn an array to a Node.js stream.

The array can contains Promise, Generator and GeneratorFunction

Install

$ npm install --save to-stream

Example

var Promise = require('promise');
var toStream = require('to-stream');

var promise = new Promise(function (resolve, reject) {
  setTimeout(function () {
    resolve('b');
  });
});

var gen = function *() {
  yield 'c';
  yield 'd';
};

toStream(['a', null, promise, gen])
  .on('data', function (data) {
    if (toStream.isNull(data)) {
      console.log('null');
    } else {
      console.log(data);
    }
  });

API

toStream(Array)

toStream(Generator)

toStream(GeneratorFunction)

toStream.isNull()

toStream.isUndefined()

License

The MIT License (MIT)

http://poying.mit-license.org/

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago