Skip to content

ninegrid/baptize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

baptize

Dunk an es6 generator (function or object) in the stream for good laughs.

'use strict'
var baptize = require('baptize'),
    termp = require('term-pipe');

// nifty
var fib = function*(){
  let x = bint(0), y = bint(1), z = bint(0);
  while(true){
    z = x.add(y);
    x = y;
    y = z;
    yield y;
  }
};

// it just works
baptize(fib).pipe(termp);

// it just works
baptize(fib()).pipe(termp);

About

convert a generator (pull) to a stream (push)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published