pull-generate
pull-stream source that produces data on state transitions
Last updated 11 years ago by regular .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install pull-generate 
SYNC missed versions from official npm registry.

pull-generate

A pull-stream source that produces data on state transitions

Simple Example

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

Usage

generate(initialState, expand [, onAbort])

  • expand: function that is called with initialstate and a callback.
    • the callback has the following signature: callback(err, data, newState)
      • err
        • null to pass data downstream (normal operation)
        • true indicates the end of the stream
        • everything else is treated as an error
      • data is send downstream (only if err === null)
      • newState is used as state in the next call to expand.
  • onAbort: optional function that is called after the stream ended
    • is called with null or an error object

License

MIT

Current Tags

  • 2.2.0                                ...           latest (11 years ago)

7 Versions

  • 2.2.0                                ...           11 years ago
  • 2.1.0                                ...           11 years ago
  • 2.0.2                                ...           11 years ago
  • 2.0.1                                ...           11 years ago
  • 2.0.0                                ...           11 years ago
  • 1.0.1                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |