# async-parts

> Minimal async-chainables

Latest version **0.2.2** (published 2015-12-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2015-12-05 |
| First published | 2014-10-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alvaro Cabrera |
| Maintainers | pateketrueke |

## Links

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

## Recent versions

- 0.2.2 (latest) — 2015-12-05
- 0.2.1 — 2014-12-02
- 0.2.0 — 2014-11-06
- 0.1.0 — 2014-10-27

## README

[![Build Status](https://api.travis-ci.org/partsjs/async.png?branch=master)](https://travis-ci.org/partsjs/async?branch=master) [![NPM version](https://badge.fury.io/js/async-parts.png)](http://badge.fury.io/js/async-parts) [![Coverage Status](https://coveralls.io/repos/partsjs/async/badge.png?branch=master)](https://coveralls.io/r/partsjs/async?branch=master)

```javascript
var Async = require('async-parts');

// next()-chained async tasks
(new Async)
  .catch(function(err, next) {
    if (err) {
      console.log(err);
    }
    next();
  })
  .then(function(next) {
    next(/* error, data, ... */);
    // or throw new Error(...)
  })
  .run(function(err, data) {
    // err will be empty on success
    // data will be collected from next()
  });
```

Usage
-----

`new Async(context)` will expose three methods:

- **catch(handler)** &mdash; Error handler for the chain
- **then(handler)** &mdash; Adds a subtask to chain
- **run(success)** &mdash; Initialize the chain

The created chain will be consumed until there are no more subtasks to invoke.

The constructor function can accept a **context** that will be bound on each callback.

`Async.queue()` is **deprecated** since `0.2.0`.

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