npm package: @promises/times-parallel
Description: Times Parallel is package from Promises library
Author: Yisrael Eliev
Latest version: 0.5.0



# @promises/times-parallel
[![Source Code](https://img.shields.io/badge/%3C%2F%3E-source_code-blue.svg)](https://github.com/yisraelx/promises/blob/master/modules/times-parallel)
[![Version](https://img.shields.io/npm/v/@promises/times-parallel.svg)](https://www.npmjs.com/package/@promises/times-parallel)
[![MIT License](https://img.shields.io/npm/l/@promises/times-parallel.svg)](https://github.com/yisraelx/promises/blob/master/LICENSE)
[![Bundle Size](https://img.shields.io/bundlephobia/min/@promises/times-parallel.svg)](https://bundlephobia.com/result?p=@promises/times-parallel)

**Times Parallel is package from Promises library**

## Use

**Module**
```sh
$ npm install --save @promises/times-parallel
```
```typescript
import {
 default as timesParallel
} from '@promises/times-parallel';
```

**Browser**
```html
<script src="https://unpkg.com/@promises/times-parallel/bundle.umd.min.js"></script>
```
```typescript
let {
 timesParallel
} = P;
```


**Examples**
```typescript
 let times: number = 3;

 timesParallel(times, (time: number) => {
     let ms = (times-time) * 3;
     return timeout((resolve) => {
         console.log(time);
         resolve(ms);
     }, ms);
 }).then((result: number[]) => {
     console.log(result);
 });

 // => 2
 // => 1
 // => 0
 // => [9, 6, 3]
```


### Functional programming

**Module**
```sh
$ npm install --save @promises/times-parallel
```
```typescript
import {
 __,
 default as timesParallel
} from '@promises/times-parallel/fp';
```

**Browser**
```html
<script src="https://unpkg.com/@promises/times-parallel/fp/bundle.umd.min.js"></script>
```
```typescript
let {
 __,
 timesParallel
} = PF;
```


**Examples**
```typescript
 let times: number = 3;

 timesParallel((time: number) => {
     let ms = (times-time) * 3;
     return timeout((resolve) => {
         console.log(time);
         resolve(ms);
     }, ms);
 })(1)(times).then((result: number[]) => {
     console.log(result);
 });

 // => 0
 // => 1
 // => 2
 // => [9, 6, 3]
```


### Wrapper

**Module**
```sh
$ npm install --save @promises/times-parallel
```
```typescript
import Promises from '@promises/core';
import '@promises/times-parallel/add';
```
*Or*
```typescript
import Promises from '@promises/times-parallel/add';
```

**Browser**
```html
<script src="https://unpkg.com/@promises/core/bundle.umd.min.js"></script>
<script src="https://unpkg.com/@promises/times-parallel/add/bundle.umd.min.js"></script>
```
```typescript
let {
 Promises
} = P;
```


**Examples**
```typescript
 let times: number = 3;

 Promises.timesParallel(times, (time: number) => {
     let ms = (times-time) * 3;
     return timeout((resolve) => {
         console.log(time);
         resolve(ms);
     }, ms);
 }).then((result: number[]) => {
     console.log(result);
 });

 // => 2
 // => 1
 // => 0
 // => [9, 6, 3]
```


## Compatibility
These modules are written in typescript and available in ES5 and ES6 standard, the requirements are a global __Promise__ (native or polyfill).

## License
Copyright © 2017 [Yisrael Eliav](https://github.com/yisraelx),
Licensed under the [MIT license](https://github.com/yisraelx/promises/blob/master/LICENSE).