eres

1.0.1 • Public • Published

eres

Use async/await with [err, result] instead of try/catch.

usage

Instead of:

let result
try {
  result = await fetch('https://...')
} catch (err) {
  console.error('no workie')
}
render(result)

You can now:

const [err, result] = await eres(fetch('https://...'))
if (err) return console.error('no workie')
render(result)

Don't spend all the vertical space you get back in one place.

installation

npm install eres

related

Readme

Keywords

none

Package Sidebar

Install

npm i eres

Weekly Downloads

31

Version

1.0.1

License

MIT

Last publish

Collaborators

  • timwis