1.0.0 • Published 7 years ago

pull-flatten-deep v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

pull-flatten-deep

npm version build status test coverage downloads js-standard-style

Pull-stream which recursively flattens streams of streams.

Usage

const pull = require('pull-stream')
const flattenDeep = require('pull-flatten-deep')

 pull(
  pull.values([1, 2, pull.values([3, 4, pull.values([5, 6]), 7, 8, pull.values([9, 10, pull.values([11, 12])])])]),
  flattenDeep(),
  pull.collect(function (err, all) {
    console.log(all.toString() === [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].toString())
    // true
  })
)

API

flattenDeep

Usage: pull(source, flattenDeep(), sink)

Provides a pull stream through which flattens nested streams, and like pull.flatten, runs them sequentially.

Installation

$ npm install pull-flatten-deep

Acknowledgement

This function is heavily based on dominictarr's original pull.flatten. Imitation is the sincerest form of flattery.

License

MIT dominictarr