# @joegesualdo/promise-queue

> Syncronously run promises.

Latest version **0.0.5** (published 2016-06-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @joegesualdo/promise-queue
pnpm add @joegesualdo/promise-queue
yarn add @joegesualdo/promise-queue
bun add @joegesualdo/promise-queue
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2016-06-25 |
| First published | 2016-06-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Joe Gesualdo |
| Maintainers | joegesualdo |

## Links

- npm: https://www.npmjs.com/package/@joegesualdo/promise-queue
- Repository: https://github.com/joegesualdo/promise-queue-js
- Homepage: https://github.com/joegesualdo/promise-queue-js#readme
- Issues: https://github.com/joegesualdo/promise-queue-js/issues
- npm.io page: https://npm.io/package/@joegesualdo/promise-queue

## Recent versions

- 0.0.5 (latest) — 2016-06-25
- 0.0.3 — 2016-06-25
- 0.0.2 — 2016-06-25
- 0.0.1 — 2016-06-25

## README

## promise-queue [![Build Status](https://travis-ci.org/joegesualdo/promise-queue-js.svg?branch=master)](https://travis-ci.org/joegesualdo/promise-queue-js)
> Syncronously run promises.

## Install
```
$ npm install --save @joegesualdo/promise-queue
```

## Usage
```javascript
var PromiseQueue = require("@joegesualdo/promise-queue").default

// Create Test Promises
let promises = [];
promises.push(function(results) {
  return new Promise((resolve, reject) => {
    results.name = 'joe';
    resolve(results)
  })
})
promises.push(function(results) {
  return new Promise((resolve, reject) => {
    results.age = 22
    resolve(results)
  })
})

// Initailize the PromiseQueue with an array of promises
promiseQueue = new PromiseQueue(promises)

// Run all the promises syncronously.
promiseQueue.run({})
.then(function(results){
  console.log(results)
})
```

## Test
```
$ npm test
```
## API
### `constructor(promises)`
> Initializes a new PromiseQueue 

| Name | Type | Description |
|------|------|-------------|
| promises | `Array<Promise>` | Array of promises you want to run | 

Returns: `PromiseQueue` 

```javascript
var PromiseQueue = require("@joegesualdo/promise-queue").default

// Create Test Promises
let promises = [];
promises.push(function(results) {
  return new Promise((resolve, reject) => {
    results.name = 'joe';
    resolve(results)
  })
})
promises.push(function(results) {
  return new Promise((resolve, reject) => {
    results.age = 22
    resolve(results)
  })
})

promiseQueue = new PromiseQueue(promises)
```
### `run(startingObj)`
> Runs the promises in the order they appear in the array.

| Name | Type | Description |
|------|------|-------------|
| startingObj | `Object` | The object that will be passed to the first promise;

```javascript
var PromiseQueue = require("@joegesualdo/promise-queue").default

// Create Test Promises
let promises = [];
promises.push(function(results) {
  return new Promise((resolve, reject) => {
    results.name = 'joe';
    resolve(results)
  })
})
promises.push(function(results) {
  return new Promise((resolve, reject) => {
    results.age = 22
    resolve(results)
  })
})

// Initailize the PromiseQueue with an array of promises
promiseQueue = new PromiseQueue(promises)

// Run all the promises syncronously.
promiseQueue.run({})
.then(function(results){
  console.log(results)
})
```
## Build
```
$ npm run build
```
## License
MIT © [Joe Gesualdo]()

---
_Source: https://npm.io/package/@joegesualdo/promise-queue · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
