Skip to content

Latest commit

 

History

History
29 lines (19 loc) · 1.31 KB

README.md

File metadata and controls

29 lines (19 loc) · 1.31 KB

fAwait

codecov Build Status Greenkeeper badge

Installation

npm install --save fawait

What is fAwait?

fAwait is a javascript library for working with the await syntax for promises.

Wrap your promise in the fa function, and provide errors you want to catch, and you'll receive an array you can unpack to those values. Any errors not specified will be thrown.

Read about it: Making Await More Functional in JavaScript

let [data, typeError, customBadThing] = await fa(promise, TypeError, BadThing);

Alternatives / Prior Art

  • fPromise which is a heavier-weight promise solution.
  • safe-await which converts all errors to this functional form.
  • go-for-it which converts all non-native errors to this functional form.