Add some
.
This commit is contained in:
parent
78d26ef021
commit
ce97802a8e
3 changed files with 40 additions and 0 deletions
18
doc/API.md
18
doc/API.md
|
@ -23,6 +23,7 @@
|
|||
- [reduce(callbackfn[, initialValue])](#reducecallbackfn-initialvalue)
|
||||
- [shift() -> async](#shift---async)
|
||||
- [slice(start[, end]) -> Channel](#slicestart-end---channel)
|
||||
- [some(callbackfn[, thisArg])](#somecallbackfn-thisarg)
|
||||
- [Functional API](#functional-api)
|
||||
|
||||
<!-- /TOC -->
|
||||
|
@ -286,6 +287,23 @@ pushed.
|
|||
|
||||
Unlike in `Array`'s method, `start` and `end` cannot be negative.
|
||||
|
||||
### some(callbackfn[, thisArg])
|
||||
|
||||
`callbackfn` should be a function that accepts one argument and returns a value
|
||||
that is coercible to the Boolean values `true` or `false`. `some` calls
|
||||
`callbackfn` once for each value in the channel until it finds one where
|
||||
`callbackfn` returns `true`. If such a value is found, `some` immediately
|
||||
returns `true`. Otherwise, `some` returns `false`.
|
||||
|
||||
If a `thisArg` parameter is provided, it will be used as the `this` value for
|
||||
each invocation of `callbackfn`. If it is not provided, `undefined` is used
|
||||
instead.
|
||||
|
||||
Unlike in `Array`'s method, `callbackfn` is called with only one argument.
|
||||
|
||||
`some` acts like the "exists" quantifier in mathematics. In particular, for an
|
||||
empty channel, it returns `false`.
|
||||
|
||||
# Functional API
|
||||
|
||||
There is a parallel API to support functional-style programming. Every channel
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue