# sequential-promise-all

> Promise.all with super powers

Latest version **1.0.2** (published 2019-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install sequential-promise-all
pnpm add sequential-promise-all
yarn add sequential-promise-all
bun add sequential-promise-all
```

## Health

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

Positive: no vulnerabilities; high maintenance score.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-03-23 |
| First published | 2019-03-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Adam Quinton |
| Maintainers | zvakanaka |
| Keywords | sequential, promise, all, loop, sequence |

## Links

- npm: https://www.npmjs.com/package/sequential-promise-all
- Repository: https://github.com/zvakanaka/sequential-promise-all
- Homepage: https://github.com/zvakanaka/sequential-promise-all#readme
- Issues: https://github.com/zvakanaka/sequential-promise-all/issues
- npm.io page: https://npm.io/package/sequential-promise-all

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2019-03-23
- 1.0.1 — 2019-03-21
- 1.0.0 — 2019-03-21

## README

Modify inputs of next call to promise based on output of previous
## Example
### Progress bar
```js
const sequentialPromiseAll = require('sequential-promise-all');
const barChart = require('bar-charts');
const timeout = ms => new Promise(res => setTimeout(() => res(ms), ms));

(async () => {
  const n = 100; // number of times to call promise
  await sequentialPromiseAll(
    timeout, // function that returns a promise (will be called n times after previous one resolves)
    [1000], // arguments array provided to promise (timeout)
    n, // number of times to call promise
    ( // callback - invoked after each promise resolution
    argsHandle, // modify this in the callback to change the arguments at the next invocation
    previousResponse, // what is resolved from promise (timeout)
    i) => {
    process.stdout.clearLine();
    process.stdout.cursorTo(0);
    const count = (i + 1) / n * 100;
    const outputStr = barChart([{label: `${i + 1}/${n}`, count}], {percentages: true});
    process.stdout.write(outputStr); // print the bar
    argsHandle[0] = Math.max(previousResponse - 40, 10); // speed up over time
  });
})();
```

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