https://github.com/nichoth/pull-flat-merge
Flat map for pull streams
https://github.com/nichoth/pull-flat-merge
Last synced: 11 months ago
JSON representation
Flat map for pull streams
- Host: GitHub
- URL: https://github.com/nichoth/pull-flat-merge
- Owner: nichoth
- Created: 2016-10-17T16:37:38.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-10-27T20:04:56.000Z (over 2 years ago)
- Last Synced: 2025-08-19T20:33:37.743Z (11 months ago)
- Language: JavaScript
- Homepage: https://github.com/nichoth/pull-flat-merge#readme
- Size: 23.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# pull flat merge
A transform that takes a stream of streams and emits their values, in the order they arrive. This is in contrast to `.flatten`, which keeps the original order.
## example
join:
```js
var test = require('tape')
var S = require('pull-stream')
var join = require('pull-flat-merge')
test('flat merge', function (t) {
t.plan(2)
var ss = S.values([
S.values([1,2,3]),
S.values(['a', 'b', 'c'])
])
S(
ss,
join(),
S.collect(function (err, evs) {
t.error(err)
t.deepEqual(evs, [1,'a',2,'b',3,'c'], 'should emit the events')
})
)
})
```
chain:
```js
// this is equivalent to `map` followed by `join`
var S = require('pull-stream')
var chain = require('pull-flat-merge/chain')
S(
S.values([1,2,3]),
chain(function (n) {
return S.once(n)
}),
S.log()
)
```