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



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

**Times Series is package from Promises library**

## Use

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

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


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

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

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


### Functional programming

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

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


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

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

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


### Wrapper

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

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


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

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

 // => 0
 // => 1
 // => 2
 // => [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).