Skip to content

antoninlanglade/promise-all-obj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

promise-all-obj

Promise All from Object


Requirements

  • Polyfill Promise on old browsers

Features

  • Promise.all({...})

Module Installation

$ npm install --save @antoninlanglade/promise-all-obj

Usage

import PromiseAllObj from 'promise-all-obj' // web
// or
const PromiseAllObj = require('promise-all-obj') // node

var testObj = {
  promise1: new Promise((res, rej) => {
    setTimeout(() => res('p1'), 2000)
  }),
  promise2: new Promise((res, rej) => res('p2'))
};

PromiseAllObj(testObj)
  .then((results) => console.log(results)) // {promise1: 'p1', promise2: 'p2'}
  .catch((err) => console.log(err)) // Errors

License

MIT.

About

Promise all from object input

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published