from: Support 'mapfn'.

This commit is contained in:
David Braun 2017-10-22 02:59:29 -04:00
parent 6b577ea6cd
commit 8088d7e096
No known key found for this signature in database
GPG key ID: 5694EEC4D129BDCF
3 changed files with 16 additions and 4 deletions

View file

@ -12,7 +12,7 @@
- [Channel([bufferLength = 0]) -> Channel](#channelbufferlength--0---channel)
- [Channel.isChannel(value) -> Boolean](#channelischannelvalue---boolean)
- [Channel.of(...values) -> Channel](#channelofvalues---channel)
- [Channel.from(callback | iterable | stream.Readable) -> Channel](#channelfromcallback--iterable--streamreadable---channel)
- [Channel.from(callback | iterable | stream.Readable[, mapfn [, thisArg]]) -> Channel](#channelfromcallback--iterable--streamreadable-mapfn--thisarg---channel)
- [Channel Object](#channel-object)
- [every(callbackfn[, thisArg]) -> async Boolean](#everycallbackfn-thisarg---async-boolean)
- [filter(callbackfn[, thisArg]) -> Channel](#filtercallbackfn-thisarg---channel)
@ -164,7 +164,7 @@ Return `true` if `value` is a channel, `false` otherwise.
Push `values` into a new channel and then close it.
### Channel.from(callback | iterable | stream.Readable) -> Channel
### Channel.from(callback | iterable | stream.Readable[, mapfn [, thisArg]]) -> Channel
Create a new `Channel` from a callback function, an iterable, or a [Node.js
readable stream](https://nodejs.org/api/stream.html#stream_readable_streams).
@ -173,6 +173,9 @@ If given a callback function, call the function repeatedly to obtain values for
pushing into the channel. Close the channel when the function returns
`undefined`.
If the optional `mapfn` argument is provided, call it (using the also optional
`thisArg`) on each value before pushing it into the channel.
## Channel Object
### every(callbackfn[, thisArg]) -> async Boolean