pull-collect-promise
v0.0.0
Published
Pull-stream sink that collects values into an array then returns a promise.
Downloads
11
Readme
pull-collect-promise
Pull-stream sink that collects values into an array then returns a promise. allowing you to interop between pull-streams and promises.
Install
npm i pull-collect-promise
Usage
collectPromise()
Returns a sink stream that returns a promise.
const { pull, map, values } = require('pull-stream')
const collectPromise = require('pull-collect-promise')
const foo = pull(
values([ 1, 2, 3, 4 ]),
map(x => x * 3),
collectPromise()
)
foo.then(results => {
t.same(results, [ 3, 6, 9, 12 ])
})