# @karmaniverous/async-find

> Test values against a cascade of async functions to find the first one that passes all of them.

Latest version **2.1.7** (published 2023-02-22) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install @karmaniverous/async-find
pnpm add @karmaniverous/async-find
yarn add @karmaniverous/async-find
bun add @karmaniverous/async-find
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.7 |
| Published | 2023-02-22 |
| First published | 2022-07-14 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jason G. Williscroft |
| Maintainers | karmaniverous |
| Keywords | async, find |

## Links

- npm: https://www.npmjs.com/package/@karmaniverous/async-find
- Repository: https://github.com/karmaniverous/async-find
- Homepage: https://github.com/karmaniverous/async-find#readme
- Issues: https://github.com/karmaniverous/async-find/issues
- npm.io page: https://npm.io/package/@karmaniverous/async-find

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 2.1.7 (latest) — 2023-02-22
- 2.0.0-0 (next) — 2022-12-20
- 2.1.6 — 2023-02-22
- 2.1.5 — 2023-02-22
- 2.1.3 — 2023-01-04
- 2.1.2 — 2022-12-30
- 2.1.1 — 2022-12-22
- 2.1.0 — 2022-12-21
- 2.0.2 — 2022-12-21
- 2.0.1 — 2022-12-20
- 2.0.0 — 2022-12-20
- 1.0.2 — 2022-12-19
- 1.0.1 — 2022-12-19
- 1.0.0 — 2022-12-19
- 0.0.2-5 — 2022-12-19
- … 7 more at https://npm.io/package/@karmaniverous/async-find/versions

## README

# async-find

To install:

```bash
npm install @karmaniverous/async-find
```

To import:

```js
import { asyncFind } from '@karmaniverous/async-find`;
```

See
[tests](https://github.com/karmaniverous/async-find/blob/main/lib/asyncFind/asyncFind.test.js)
for examples of usage!

# API Documentation

## Functions

<dl>
<dt><a href="#asyncFind">asyncFind(values, predicates)</a> ⇒ <code>Array</code></dt>
<dd><p>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.</p>
</dd>
</dl>

## Typedefs

<dl>
<dt><a href="#Predicate">Predicate</a> ⇒ <code>*</code></dt>
<dd><p>async predicate function callback</p>
</dd>
</dl>

<a name="asyncFind"></a>

## asyncFind(values, predicates) ⇒ <code>Array</code>
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**: <code>Array</code> - An array containing the first input value that survived allpredicates, and its final predicate output.  

| Param | Type | Description |
| --- | --- | --- |
| values | <code>Array</code> | array of values |
| predicates | [<code>Array.&lt;Predicate&gt;</code>](#Predicate) | array of async predicate functions |

<a name="Predicate"></a>

## Predicate ⇒ <code>\*</code>
async predicate function callback

**Kind**: global typedef  
**Returns**: <code>\*</code> - output  

| Param | Type | Description |
| --- | --- | --- |
| [value] | <code>\*</code> | value to be tested |


---

See more great templates and other tools on
[my GitHub Profile](https://github.com/karmaniverous)!

---
_Source: https://npm.io/package/@karmaniverous/async-find · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
