1.0.1 • Published 4 years ago

psp-collect v1.0.1

Weekly downloads
11
License
-
Repository
github
Last release
4 years ago

Pull stream collect

A modern version of the pull-stream collect sink which returns a promise rather than calling a callback.

collect()
const {pull, values, map} = require('pull-stream')
const collect = require('psp-collect')

pull(values([1, 2, 3]), map(x => x * 2), collect()).then(console.log)
// [ 2, 4, 6 ]

Abort

Aborting without an error will end the stream and return the value so far.

abort([err])
const {pull, values} = require('pull-stream')
const collect = require('psp-collect')

const sink = collect()
sink.abort()
pull(values([1, 2, 3]), sink).then(console.log)
// []
1.0.1

4 years ago

1.0.0

5 years ago