1.0.0 • Published 4 years ago

@acallaris/promise-js v1.0.0

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

@acallaris/promise-js

Handle promises like never before

Installation

$ npm install @acallaris/promise-js

Usage

You must first import it to your project

import { handlePromise, handlePromiseArray } from '@acallaris/promise-js';

// Or
import * as promise from '@acallaris/promise-js';

Then, you can use it like this.

// Handle a single promise
const [data, error] = await handlePromise(yourAsyncFunction());

// Handle an array of promises
const [data, error] = await handlePromiseArray([
  yourAsyncFunction(),
  anotherAsyncFunction(),
  yetAnotherAsyncFunction()
]);