0.3.0 • Published 2 years ago

@wei-tools/atc v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

atc

A solution of async/await error catch.

usage

# npm install @wei-tools/atc
# yarn add @wei-tools/atc
import atc from '@wei-tools/atc';

const foo = async () => {
  let [reason, value] = await atc(Promise.resolve('value')); // undefined 'value'
  [reason, value] = await atc(Promise.reject('reason')); // 'reason' undefined
};