@promises/filter-parallel

Filter Parallel is package from Promises library

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@promises/filter-parallel
500.5.05 years ago6 years agoMinified + gzip package size for @promises/filter-parallel in KB

Readme

@promises/filter-parallel
Source Code Version MIT License Bundle Size
Filter Parallel is package from Promises library

Use

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

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

Examples
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
$ npm install --save @promises/filter-parallel
import {
 __,
 default as filterParallel
} from '@promises/filter-parallel/fp';

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

Examples
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
$ npm install --save @promises/filter-parallel
import Promises from '@promises/core';
import '@promises/filter-parallel/add';
Or
import Promises from '@promises/filter-parallel/add';

Browser
<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>
let {
 Promises
} = P;

Examples
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, Licensed under the MIT license.