golangify
Golang like error handling for async/await
Install
$ yarn add golangify
Usage
const go = const main = async { // Async const success = Promise const failure = Promise console // => [ 2, null ] const result err = await if err !== null console // => err console // => null // Sync const successSync = x + x const failureSync = 'err' console // => [ 2, null ] const result err = if err !== null console // => err console // => null }
API
golangify(func)
func
Type: function
Success
return [result, null]
Failure
return [null, err]
Contributors
Thanks goes to these wonderful people (emoji key):
akameco 💻 📖 ⚠️ 🚇 |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
License
MIT © akameco