poss

3.0.2 • Public • Published

poss

"This poss might work..."

Slightly better-looking error handling for generators and async/await.

Instead of this:

try {
  var resource = await fetch(token)
} catch (err) {
  // do something with the error
}
// do something with the resource

You can do this:

const [err, resource] = await poss(fetch(token))
if (err !== null) {
  // do something with the error
}
 
// do something with the resource

Installation

npm install poss

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i poss

Weekly Downloads

8

Version

3.0.2

License

none

Last publish

Collaborators

  • mattmueller