async-find
To install:
npm install @karmaniverous/async-find
To import:
import { asyncFind } from '@karmaniverous/async-find`;
See tests for examples of usage!
API Documentation
Functions
-
asyncFind(values, predicates) ⇒
Array
-
Step through a array of input values. Pass each input value through an array of async predicate functions, passing the output of each predicate as the input of the next, until either the predicates are exhausted or one of them returns a falsy result.
Typedefs
-
Predicate ⇒
*
-
async predicate function callback
Array
asyncFind(values, predicates) ⇒ Step through a array of input values. Pass each input value through an array of async predicate functions, passing the output of each predicate as the input of the next, until either the predicates are exhausted or one of them returns a falsy result.
Kind: global function
Returns: Array
- An array containing the first input value that survived all
predicates, and its final predicate output.
Param | Type | Description |
---|---|---|
values | Array |
array of values |
predicates | Array.<Predicate> |
array of async predicate functions |
*
Predicate ⇒ async predicate function callback
Kind: global typedef
Returns: *
- output
Param | Type | Description |
---|---|---|
[value] | * |
value to be tested |
See more great templates and other tools on my GitHub Profile!