

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

**Filter Parallel is package from Promises library**

## Use

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

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


**Examples**
```typescript
 let comparator = (value: number) => {
     return value % 2 === 0;
 };

 let array = Array.from({length:5}, (value, index) => index);

 filterParallel(array, comparator).then((result: number[])=>{
     console.log(result); // result => [0, 2, 4]
 });
```


### Functional programming

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

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


**Examples**
```typescript
 let comparator = (value: number) => {
     return value % 2 === 0;
 };

 let array = Array.from({length:5}, (value, index) => index);

 filterParallel(comparator)(void 0, array).then((result: number[])=>{
     console.log(result); // result => [0, 2, 4]
 });
```


### Wrapper

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

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


**Examples**
```typescript
 let comparator = (value: number) => {
     return value % 2 === 0;
 };

 let array = Array.from({length:5}, (value, index) => index);
 let promises = Promises.resolve(array);

 promises.filterParallel(comparator).then((result: number[])=>{
     console.log(result); // result => [0, 2, 4]
 });
```


## 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).
