asyncawaitpromise

1.0.1 • Public • Published

asyncawaitpromise

One liner to add async/await and promises to your project, without globals

Check out global-asyncawaitpromise for a shorter one-liner that uses globals

Quickstart

const {Promise, async, await} = require('asyncawaitpromise')

// Now we can use async/await and Promise
const main = async(() => {
  console.log(3)
  await(Promise.delay(1000))
  console.log(2)
  await(Promise.delay(1000))
  console.log(1)
  await(Promise.delay(1000))
  console.log('🚀')
})

main()

Docs

The following objects are provided

Why do I need this?

Because callback hell sucks, and it's tedious to have to keep writing this boilerplate

const Promise = require('bluebird')
const async = require('asyncawait/async')
const await = require('asyncawait/await')

Package Sidebar

Install

npm i asyncawaitpromise

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • dikarel