# chan-async

> A wrapper for chan to support promises

Latest version **1.0.0** (published 2018-08-11) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-08-11 |
| First published | 2018-08-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | rcpooley |
| Maintainers | rcpooley |
| Keywords | chan, channel, async, promise |

## Links

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

## Dependencies (1)

- [chan](https://npm.io/package/chan.md) ^0.6.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

- 1.0.0 (latest) — 2018-08-11

## README

# chan-async
A wrapper for [chan](https://www.npmjs.com/package/chan) to support promises.

## Installation
```bash
$ npm install chan-async
```

## Usage
First import chan-async
```js
const makeChan = require('chan-async');
```
Create a channel
```js
const ch = makeChan((val) => {
    return new Promise((resolve) => {
        console.log(`Read value: ${val}`);
        setTimeout(() => resolve(val * 2), 500);
    });
});
```
Write to the channel
```js
ch(42) // Returns a promise
    .then((res) => console.log(`Result: ${res}`))
    .catch((err) => console.error(err));
```

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