1.0.1 • Published 7 years ago

eres v1.0.1

Weekly downloads
26
License
MIT
Repository
-
Last release
7 years ago

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