Clarify documentation to fix #3.
This commit is contained in:
parent
95a575fd2d
commit
1f8e3c46ee
1 changed files with 50 additions and 50 deletions
78
doc/API.md
78
doc/API.md
|
@ -1,35 +1,35 @@
|
||||||
<!-- TOC -->
|
<!-- TOC -->
|
||||||
|
|
||||||
- [New Properties](#new-properties)
|
* [New Properties](#new-properties)
|
||||||
- [close() -> async](#close---async)
|
* [close() -> (async)](#close---async)
|
||||||
- [readOnly() -> Channel](#readonly---channel)
|
* [readOnly() -> Channel](#readonly---channel)
|
||||||
- [writeOnly() -> Channel](#writeonly---channel)
|
* [writeOnly() -> Channel](#writeonly---channel)
|
||||||
- [Channel.select(promises) -> async channel](#channelselectpromises---async-channel)
|
* [Channel.select(promises) -> (async) channel](#channelselectpromises---async-channel)
|
||||||
- [Examples](#examples)
|
* [Examples](#examples)
|
||||||
- [value()](#value)
|
* [value()](#value)
|
||||||
- [Array-like Properties](#array-like-properties)
|
* [Array-like Properties](#array-like-properties)
|
||||||
- [Channel](#channel)
|
* [Channel](#channel)
|
||||||
- [Channel([bufferLength]) -> Channel](#channelbufferlength---channel)
|
* [Channel([bufferLength]) -> Channel](#channelbufferlength---channel)
|
||||||
- [Channel.isChannel(value) -> Boolean](#channelischannelvalue---boolean)
|
* [Channel.isChannel(value) -> Boolean](#channelischannelvalue---boolean)
|
||||||
- [Channel.of(...values) -> read-only Channel](#channelofvalues---read-only-channel)
|
* [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)
|
* [Channel.from(callback | iterable | stream.Readable[, mapfn [, thisArg]]) -> read-only Channel](#channelfromcallback--iterable--streamreadable-mapfn--thisarg---read-only-channel)
|
||||||
- [Examples](#examples-1)
|
* [Examples](#examples-1)
|
||||||
- [Channel Object](#channel-object)
|
* [Channel Object](#channel-object)
|
||||||
- [concat(...arguments) -> Channel](#concatarguments---channel)
|
* [concat(...arguments) -> Channel](#concatarguments---channel)
|
||||||
- [every(callbackfn[, thisArg]) -> async Boolean](#everycallbackfn-thisarg---async-boolean)
|
* [every(callbackfn[, thisArg]) -> (async) Boolean](#everycallbackfn-thisarg---async-boolean)
|
||||||
- [filter(callbackfn[, thisArg]) -> Channel](#filtercallbackfn-thisarg---channel)
|
* [filter(callbackfn[, thisArg]) -> Channel](#filtercallbackfn-thisarg---channel)
|
||||||
- [forEach(callbackfn[, thisArg]) -> async](#foreachcallbackfn-thisarg---async)
|
* [forEach(callbackfn[, thisArg]) -> (async)](#foreachcallbackfn-thisarg---async)
|
||||||
- [join(separator) -> async String](#joinseparator---async-string)
|
* [join(separator) -> (async) String](#joinseparator---async-string)
|
||||||
- [length](#length)
|
* [length](#length)
|
||||||
- [map(callbackfn[, thisArg]) -> Channel](#mapcallbackfn-thisarg---channel)
|
* [map(callbackfn[, thisArg]) -> Channel](#mapcallbackfn-thisarg---channel)
|
||||||
- [push(value) -> async bufferLength](#pushvalue---async-bufferlength)
|
* [push(value) -> (async) bufferLength](#pushvalue---async-bufferlength)
|
||||||
- [reduce(callbackfn[, initialValue]) -> async](#reducecallbackfn-initialvalue---async)
|
* [reduce(callbackfn[, initialValue]) -> (async)](#reducecallbackfn-initialvalue---async)
|
||||||
- [shift() -> async](#shift---async)
|
* [shift() -> (async)](#shift---async)
|
||||||
- [slice(start[, end]) -> Channel](#slicestart-end---channel)
|
* [slice(start[, end]) -> Channel](#slicestart-end---channel)
|
||||||
- [some(callbackfn[, thisArg])](#somecallbackfn-thisarg)
|
* [some(callbackfn[, thisArg])](#somecallbackfn-thisarg)
|
||||||
- [toString() -> String](#tostring---string)
|
* [toString() -> String](#tostring---string)
|
||||||
- [values() -> async iterator](#values---async-iterator)
|
* [values() -> (async) iterator](#values---async-iterator)
|
||||||
- [Functional API](#functional-api)
|
* [Functional API](#functional-api)
|
||||||
|
|
||||||
<!-- /TOC -->
|
<!-- /TOC -->
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
The following properties don't have equivalents in `Array`.
|
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
|
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.
|
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.
|
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.
|
Wait for the first channel method promise to succeed and then cancel the rest.
|
||||||
Return the channel of the winning promise.
|
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
|
channel containing the values of the channel followed by the channel values of
|
||||||
each argument in order.
|
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
|
`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
|
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
|
Unlike in the Array version of `filter`, `callbackfn` is called with only one
|
||||||
argument.
|
argument.
|
||||||
|
|
||||||
### forEach(callbackfn[, thisArg]) -> async
|
### forEach(callbackfn[, thisArg]) -> (async)
|
||||||
|
|
||||||
The promise returned by `forEach` resolves when the channel is closed:
|
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
|
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
|
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.
|
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
|
Send the value into the channel and return a promise that resolves when the
|
||||||
value has been shifted or placed in the buffer.
|
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.
|
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
|
`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
|
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
|
`currentValue` will be equal to the second. It is a `TypeError` if the channel
|
||||||
contains no values and `initialValue` is not provided.
|
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.
|
Return a promise that resolves when an value is received from the channel.
|
||||||
Closed channels always return `undefined` immediately.
|
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.
|
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.
|
Return an iterator over the values in the channel.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue