$ cnpm install pull-generate
A pull-stream source that produces data on state transitions
var generate = require('pull-generate')
var pull = require('pull-stream')
pull(
generate(0, function(state, cb) {
cb(state>3 ? true : null, 1<<state, state + 1)
}),
pull.log()
)
// ==> 1 2 4 8
generate(initialState, expand [, onAbort])expand: function that is called with initialstate and a callback.
callback(err, data, newState)
err
null to pass data downstream (normal operation)true indicates the end of the streamdata is send downstream (only if err === null)newState is used as state in the next call to expand.null or an error objectMIT
Copyright 2013 - present © cnpmjs.org | Home |