1.0.2 • Published 6 months ago

await-to-done v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

await-to-done

Async await wrapper for easy error handling

NPM version Codacy Badge typescript Test coverage npm download gzip License

Sonar

DocumentationChange Log

Read this in other languages: English | 简体中文

Installing

# use pnpm
$ pnpm install await-to-done

# use npm
$ npm install await-to-done --save

Usage

ES6 module

import to from 'await-to-done'

const [err, data] = await to(/* promise function */)

Node.js require

const to = require('await-to-done')

const [err, data] = await to(/* promise function */)

Using unpkg CDN

<script src="https://unpkg.com/await-to-done@latest/dist/index.global.prod.js"></script>
<script>
  ;(async () => {
    const to = window.awaitToDone
    const [err, data] = await to(/* promise function */)
  })()
</script>

Support & Issues

Please open an issue here.

License

MIT