Clarify documentation to fix #3.

This commit is contained in:
David Braun 2018-03-20 21:21:08 -04:00
parent 95a575fd2d
commit 1f8e3c46ee
No known key found for this signature in database
GPG key ID: 5694EEC4D129BDCF

View file

@ -1,35 +1,35 @@
<!-- TOC -->
- [New Properties](#new-properties)
- [close() -> async](#close---async)
- [readOnly() -> Channel](#readonly---channel)
- [writeOnly() -> Channel](#writeonly---channel)
- [Channel.select(promises) -> async channel](#channelselectpromises---async-channel)
- [Examples](#examples)
- [value()](#value)
- [Array-like Properties](#array-like-properties)
- [Channel](#channel)
- [Channel([bufferLength]) -> Channel](#channelbufferlength---channel)
- [Channel.isChannel(value) -> Boolean](#channelischannelvalue---boolean)
- [Channel.of(...values) -> read-only Channel](#channelofvalues---read-only-channel)
- [Channel.from(callback | iterable | stream.Readable[, mapfn [, thisArg]]) -> read-only Channel](#channelfromcallback--iterable--streamreadable-mapfn--thisarg---read-only-channel)
- [Examples](#examples-1)
- [Channel Object](#channel-object)
- [concat(...arguments) -> Channel](#concatarguments---channel)
- [every(callbackfn[, thisArg]) -> async Boolean](#everycallbackfn-thisarg---async-boolean)
- [filter(callbackfn[, thisArg]) -> Channel](#filtercallbackfn-thisarg---channel)
- [forEach(callbackfn[, thisArg]) -> async](#foreachcallbackfn-thisarg---async)
- [join(separator) -> async String](#joinseparator---async-string)
- [length](#length)
- [map(callbackfn[, thisArg]) -> Channel](#mapcallbackfn-thisarg---channel)
- [push(value) -> async bufferLength](#pushvalue---async-bufferlength)
- [reduce(callbackfn[, initialValue]) -> async](#reducecallbackfn-initialvalue---async)
- [shift() -> async](#shift---async)
- [slice(start[, end]) -> Channel](#slicestart-end---channel)
- [some(callbackfn[, thisArg])](#somecallbackfn-thisarg)
- [toString() -> String](#tostring---string)
- [values() -> async iterator](#values---async-iterator)
- [Functional API](#functional-api)
* [New Properties](#new-properties)
* [close() -> (async)](#close---async)
* [readOnly() -> Channel](#readonly---channel)
* [writeOnly() -> Channel](#writeonly---channel)
* [Channel.select(promises) -> (async) channel](#channelselectpromises---async-channel)
* [Examples](#examples)
* [value()](#value)
* [Array-like Properties](#array-like-properties)
* [Channel](#channel)
* [Channel([bufferLength]) -> Channel](#channelbufferlength---channel)
* [Channel.isChannel(value) -> Boolean](#channelischannelvalue---boolean)
* [Channel.of(...values) -> read-only Channel](#channelofvalues---read-only-channel)
* [Channel.from(callback | iterable | stream.Readable[, mapfn [, thisArg]]) -> read-only Channel](#channelfromcallback--iterable--streamreadable-mapfn--thisarg---read-only-channel)
* [Examples](#examples-1)
* [Channel Object](#channel-object)
* [concat(...arguments) -> Channel](#concatarguments---channel)
* [every(callbackfn[, thisArg]) -> (async) Boolean](#everycallbackfn-thisarg---async-boolean)
* [filter(callbackfn[, thisArg]) -> Channel](#filtercallbackfn-thisarg---channel)
* [forEach(callbackfn[, thisArg]) -> (async)](#foreachcallbackfn-thisarg---async)
* [join(separator) -> (async) String](#joinseparator---async-string)
* [length](#length)
* [map(callbackfn[, thisArg]) -> Channel](#mapcallbackfn-thisarg---channel)
* [push(value) -> (async) bufferLength](#pushvalue---async-bufferlength)
* [reduce(callbackfn[, initialValue]) -> (async)](#reducecallbackfn-initialvalue---async)
* [shift() -> (async)](#shift---async)
* [slice(start[, end]) -> Channel](#slicestart-end---channel)
* [some(callbackfn[, thisArg])](#somecallbackfn-thisarg)
* [toString() -> String](#tostring---string)
* [values() -> (async) iterator](#values---async-iterator)
* [Functional API](#functional-api)
<!-- /TOC -->
@ -37,7 +37,7 @@
The following properties don't have equivalents in `Array`.
## close() -> async
## close() -> (async)
Close the channel so that no more values can be pushed to it. Return a promise
that resolves when any remaining pushes in flight complete.
@ -53,7 +53,7 @@ Return a version of the channel that provides only read methods.
Return a version of the channel that provides only write methods.
## Channel.select(promises) -> async channel
## Channel.select(promises) -> (async) channel
Wait for the first channel method promise to succeed and then cancel the rest.
Return the channel of the winning promise.
@ -209,7 +209,7 @@ When the `concat` method is called with zero or more arguments, it returns a
channel containing the values of the channel followed by the channel values of
each argument in order.
### every(callbackfn[, thisArg]) -> async Boolean
### every(callbackfn[, thisArg]) -> (async) Boolean
`callbackfn` should be a function that accepts one argument and returns a value
that is coercible to the Boolean values `true` or `false`. `every` calls
@ -239,7 +239,7 @@ instead.
Unlike in the Array version of `filter`, `callbackfn` is called with only one
argument.
### forEach(callbackfn[, thisArg]) -> async
### forEach(callbackfn[, thisArg]) -> (async)
The promise returned by `forEach` resolves when the channel is closed:
@ -265,7 +265,7 @@ const pipe = async (source, sink) => {
};
```
### join(separator) -> async String
### join(separator) -> (async) String
The values of the channel are converted to Strings, and these Strings are then
concatenated, separated by occurrences of the separator. If no separator is
@ -287,7 +287,7 @@ instead.
Unlike `Array`'s method, `callbackfn` is called with only one argument.
### push(value) -> async bufferLength
### push(value) -> (async) bufferLength
Send the value into the channel and return a promise that resolves when the
value has been shifted or placed in the buffer.
@ -301,7 +301,7 @@ promise.
Unlike `Array`'s method, accept only one `value` at a time.
### reduce(callbackfn[, initialValue]) -> async
### reduce(callbackfn[, initialValue]) -> (async)
`callbackfn` should be a function that takes two arguments (unlike `Array`'s
version which takes four). `reduce` calls the callback, as a function, once for
@ -317,7 +317,7 @@ to the first value in the channel. If no `initialValue` was provided, then
`currentValue` will be equal to the second. It is a `TypeError` if the channel
contains no values and `initialValue` is not provided.
### shift() -> async
### shift() -> (async)
Return a promise that resolves when an value is received from the channel.
Closed channels always return `undefined` immediately.
@ -354,7 +354,7 @@ empty channel, it returns `false`.
Return `"Channel(n)"` where `n` is the length of the buffer.
### values() -> async iterator
### values() -> (async) iterator
Return an iterator over the values in the channel.