Skip to content

pull-stream/pull-flatmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pull-flatmap

flatmap for pull-streams

map an input to an array, but the items in those arrays become the stream. so you can use this module to make expanding or contracting streams.

taken from example on introduction to pull-streams

example

var pull = require('pull-stream')
pull(
  pull.values([1,2,3]),
  flatmap(function (n) {
    //return an array of n n's [2,2] or [3,3,3], etc
    return new Array(n).map(function () { return n })
  }),
  pull.collect(function (err, ary) {
    if(err) throw err
    console.log(ary)
  })
)

output:

[1, 2, 2, 3, 3, 3]

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published