# async-fn-callback

> async-fn-callback =================

Latest version **0.0.1** (published 2022-01-11) · 0 weekly downloads

## Install

```sh
npm install async-fn-callback
pnpm add async-fn-callback
yarn add async-fn-callback
bun add async-fn-callback
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2022-01-11 |
| First published | 2022-01-11 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | khrome |

## Links

- npm: https://www.npmjs.com/package/async-fn-callback
- npm.io page: https://npm.io/package/async-fn-callback

## Dependencies (2)

- [chai](https://npm.io/package/chai.md) ^4.3.4
- [mocha](https://npm.io/package/mocha.md) ^9.1.3

## Recent versions

- 0.0.1 (latest) — 2022-01-11

## README

async-fn-callback
=================

I maintain a number of callback oriented libraries(even if they might offer promise interfaces at a high level), due to their much better stack handling properties. While pure promises don't offer much over callbacks, the `async`/`await` *does* offer some complexity benefits (especially if a library already uses promises heavily, meaning you already have a disconnected call stack).

This library gives you the ability to interface with these using the traditional callback idiom(so that you can handle errors and success in the same scope). It's barely any code and only exists so you(I) can avoid boilerplate.

Usage
-----

```js
const Δ = require('async-fn-callback')

Δ(async function(){
    let value = await new Promise((resolve, reject)=>{
        setTimeout(()=>{
            reject(new Error('This is an error!'))
        }, 10);
    })
    return value;
}, (err, result)=>{
    //promises underneath, but idiomatic to callbacks
});
```

Testing
-------
Just use:
```bash
./node_modules/mocha/bin/mocha
```

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