# modern-async

> A modern tooling library for asynchronous operations using async/await, promises and async generators

Latest version **2.0.4** (published 2024-10-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install modern-async
pnpm add modern-async
yarn add modern-async
bun add modern-async
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2024-10-08 |
| First published | 2020-11-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 381.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 211 |
| Author | Nicolas Vanhoren |
| Maintainers | nicolas-van |
| Keywords | async, await, promises, asynchronous, utility, util, async/await, queue, scheduler, generators |

## Links

- npm: https://www.npmjs.com/package/modern-async
- Repository: https://github.com/nicolas-van/modern-async
- Homepage: https://nicolas-van.github.io/modern-async
- Issues: https://github.com/nicolas-van/modern-async/issues
- Funding: https://github.com/sponsors/nicolas-van
- npm.io page: https://npm.io/package/modern-async

## Dependencies (2)

- [nanoassert](https://npm.io/package/nanoassert.md) ^2.0.0
- [core-js-pure](https://npm.io/package/core-js-pure.md) ^3.19.1

## 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.0.4 (latest) — 2024-10-08
- 1.1.5 — 2024-10-08
- 2.0.3 — 2024-10-08
- 2.0.2 — 2024-10-07
- 2.0.1 — 2024-10-07
- 2.0.0 — 2023-12-29
- 1.1.4 — 2023-09-15
- 1.1.3 — 2023-02-07
- 1.1.2 — 2022-01-07
- 1.1.1 — 2022-01-05
- 1.1.0 — 2021-11-08
- 1.0.4 — 2021-10-20
- 1.0.3 — 2021-08-09
- 1.0.2 — 2020-12-15
- 1.0.1 — 2020-12-15
- … 8 more at https://npm.io/package/modern-async/versions

## README

# modern-async [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Meet%20this%20awesome%20library&url=https://github.com/nicolas-van/modern-async&via=nicolasvanhoren&hashtags=javascript,asyncawait,async,libraries,programming)

![logo](https://github.com/nicolas-van/modern-async/raw/master/img/facebook_cover_photo_2_680.png)

[![Github-sponsors](https://img.shields.io/badge/sponsor-30363D?logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/nicolas-van)
[![GitHub Repo stars](https://img.shields.io/github/stars/nicolas-van/modern-async?style=social)](https://github.com/nicolas-van/modern-async/stargazers)
[![Website](https://img.shields.io/website.svg?url=http%3A%2F%2Fnicolas-van.github.io%2Fmodern-async)](https://nicolas-van.github.io/modern-async)
[![Node.js CI](https://github.com/nicolas-van/modern-async/workflows/Node.js%20CI/badge.svg)](https://github.com/nicolas-van/modern-async/actions)
[![npm](https://img.shields.io/npm/v/modern-async)](https://www.npmjs.com/package/modern-async)
[![Coverage Status](https://coveralls.io/repos/github/nicolas-van/modern-async/badge.svg?branch=master)](https://coveralls.io/github/nicolas-van/modern-async?branch=master)
[![JsDelivr](https://data.jsdelivr.com/v1/package/npm/modern-async/badge)](https://www.jsdelivr.com/package/npm/modern-async)

A modern JavaScript tooling library for asynchronous operations using async/await, promises and async generators.

This library is a modernized alternative to a lot of libraries like [Async.js](https://caolan.github.io/async/v3/) that were created using the legacy callback style to handle asynchronous operations. Its goal is to be as complete as any of those libraries while being built from the very beginning with async/await and promises in mind.

[See the documentation](https://nicolas-van.github.io/modern-async).

* Exclusively uses async/await, promises and async generators in its code, tests and documentation.
* Has low bundle size.
* Has 100% code coverage.
* Bundled for ESM modules, CommonJS and UMD.
* Works in node >= 8 and in the vast majority of browsers (very old browser compatibility can be achieved using Babel and shims).
* Has Typescript support.

[![Stargazers repo roster for @nicolas-van/modern-async](https://reporoster.com/stars/nicolas-van/modern-async)](https://github.com/nicolas-van/modern-async/stargazers)

## Installation

```bash
npm install --save modern-async
```

Or use [jsDelivr](https://www.jsdelivr.com/package/npm/modern-async) to get the UMD version. The content of the library will be available under the `modernAsync` global variable.

## Usage

```javascript
import { asyncMap, asyncSleep } from 'modern-async'

const array = [1, 2, 3]
const result = await asyncMap(array, async (v) => {
  await asyncSleep(10)
  return v * 2
})
console.log(result)
```

[See the documentation for the rest](https://nicolas-van.github.io/modern-async).

## Migrating from version 1.X to version 2.X

[See the migration guide](https://github.com/nicolas-van/modern-async/blob/master/version-1-to-2-guide.md).

## Changelog

[The changelog](https://github.com/nicolas-van/modern-async/blob/master/CHANGELOG.md).

## Contribution Guide

[The contribution guide](https://github.com/nicolas-van/modern-async/blob/master/CONTRIBUTING.md)

## License

[The license](https://github.com/nicolas-van/modern-async/blob/master/LICENSE.md).

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