0.1.5 • Published 6 years ago

promise-data v0.1.5

Weekly downloads
11
License
MIT
Repository
github
Last release
6 years ago

PromiseData

Build Coverage Status Dependencies

Executes a list of promises and stores the the results in a data object

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js.

Installation is done using the npm install command:

$ npm install promise-data

Usage

Import

import PromiseData from 'promise-data';

Runs Promises Synchronously

PromiseData.sync([
  {prop: 'prop0', promise: () => myPromise('param')},
  {prop: 'prop1', promise: mySecondPromise}
]).then(function(data) {
  console.log(data.prop0); // the result from myPromise('param')
  console.log(data.prop1); // the result from mySecondPromise()
});

Runs Promises Asynchronously

PromiseData.async([
  {prop: 'prop0', promise: () => myPromise('param');},
  {prop: 'prop1', promise: mySecondPromise}
]).then(function(data) {
  console.log(data.prop0); // the result from myPromise('param')
  console.log(data.prop1); // the result from mySecondPromise()
});

Simplified Data Format

PromiseData.async({
  prop0: () => myPromise('param'),
  prop1: mySecondPromise
}).then(function(data) {
  console.log(data.prop0); // the result from myPromise('param')
  console.log(data.prop1); // the result from mySecondPromise()
});

Credits

License

The MIT License

Copyright (c) 2018 Thomas Boles [https://github.com/tcboles]

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago