# smart-promises

> A helpfull promises helpers

Latest version **1.0.0** (published 2018-07-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install smart-promises
pnpm add smart-promises
yarn add smart-promises
bun add smart-promises
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-07-01 |
| First published | 2018-07-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | smartyua |
| Maintainers | smartyua |
| Keywords | promise water fall, promise map limit |

## Links

- npm: https://www.npmjs.com/package/smart-promises
- npm.io page: https://npm.io/package/smart-promises

## 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.0 (latest) — 2018-07-01

## README

# Smart promises

A simple and helpful promises functions to work with Promises.

## Installation

```npm i smart-promises```

## promiseWaterfall

Each promise will be executed only after previous in promises array

```
const { promiseWaterfall } = require('smart-promises');

const pool = Array.map((item) => () => promiseReturnFunction(item));
promiseWaterfall(pool)
    .then((results) => {
        <!-- do stuff with results of execution each of promise -->
    });

```
## promiseMapLimit

When you have array of promises and don't want to use `Promise.all` (mass execution all of promises) - you can use `promiseMapLimit`, that can help you runs promises small chunks with defined limit.

```
const { promiseWaterfall } = require('smart-promises');

const pool = Array.map((item) => () => promiseReturnFunction(item));
promiseMapLimit(pool, 5)
    .then((results) => {
        <!-- do stuff with results of execution each of promise -->
    });

```

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