# paralell-promises

> Promise.all() with concurrency limit

Latest version **0.0.3** (published 2019-12-03) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2019-12-03 |
| First published | 2019-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 24.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Rafael Pernil Bronchalo |
| Maintainers | rafaelpernil |
| Keywords | Promise, all, concurrent, paralell |

## Links

- npm: https://www.npmjs.com/package/paralell-promises
- Repository: https://github.com/rafaelpernil2/ParalellPromises
- Homepage: https://github.com/rafaelpernil2/ParalellPromises#readme
- Issues: https://github.com/rafaelpernil2/ParalellPromises/issues
- npm.io page: https://npm.io/package/paralell-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

- 0.0.3 (latest) — 2019-12-03
- 0.0.2 — 2019-12-03
- 0.0.1 — 2019-11-15

## README

# ParalellPromises

In this project I explore the concept of paralell promises and implement a method for executing a list of promises with a determined concurency limit.
This project is inspired by https://itnext.io/node-js-handling-asynchronous-operations-in-parallel-69679dfae3fc

## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

## Installation

Install it on your project
```Shell
npm install --save paralell-promises
```

## Usage
**Usage with Typescript**

```typescript
import { customPromiseAll } from 'paralell-promises';

...

const concurrentLimit: number = 5;

const listOfPromises: ICustomPromise[] = [
      {
        name: 'GetSomething',
        function: this.operationWrapper.getSomethingFunction,
        thisArg: this.operationWrapper,
        args: ["firstParamForFunction",{ data: "Another param"}, ["more params..."]]
      },
      {
        name: 'CreateSomething',
        function: this.createSomething,
        thisArg: undefined,
        args: ["firstParamForFunction"]
      },
      {
        name: 'RefreshSomething',
        function: this.updateSomething,
      },
      ... 
      ]

      customPromiseAll(listOfPromises, concurrentLimit).then((result)=>{
          console.log(result);
          //{ GetSomething: { Response: ... }, CreateSomething: "{ Id: 8 }", RefreshSomething: "OK" , ...} 
          ...
          // do whatever you want
      });
```

**Usage with Javascript**
```javascript
const ParalellPromises = require('paralell-promises');

...

const concurrentLimit = 5;

const listOfPromises = [
      {
        name: 'GetSomething',
        function: this.operationWrapper.getSomethingFunction,
        thisArg: this.operationWrapper,
        args: ["firstParamForFunction",{ data: "Another param"}, ["more params..."]]
      },
      {
        name: 'CreateSomething',
        function: this.createSomething,
        thisArg: undefined,
        args: ["firstParamForFunction"]
      },
      {
        name: 'RefreshSomething',
        function: this.updateSomething,
      },
      ... 
      ]

      ParalellPromises.customPromiseAll(listOfPromises, concurrentLimit).then((result: IAnyObject)=>{
          console.log(result);
          //{ GetSomething: { Response: ... }, CreateSomething: "{ Id: 8 }", RefreshSomething: "OK" , ...} 
          ...
          // do whatever you want
      });
```

## Contributing
There is no plan regarding contributions in this project
## Credits
This NPM package has been developed by:

**Rafael Pernil Bronchalo** - *Developer* 

* [github/rafaelpernil2](https://github.com/rafaelpernil2)

## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

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