0.5.0 • Published 7 years ago
@promises/every-parallel v0.5.0
@promises/every-parallel
Every Parallel is package from Promises library
Use
Module
$ npm install --save @promises/every-parallelimport {
default as everyParallel
} from '@promises/every-parallel';Browser
<script src="https://unpkg.com/@promises/every-parallel/bundle.umd.min.js"></script>let {
everyParallel
} = P;Examples
let comparator = (value: any) => {
return Promise.resolve(Boolean(value))
};
let array: any[] = [true, 1, Promise.resolve(null), 'yes'];
everyParallel(array, comparator).then((result: boolean)=>{
console.log(result) // result => false
});Functional programming
Module
$ npm install --save @promises/every-parallelimport {
__,
default as everyParallel
} from '@promises/every-parallel/fp';Browser
<script src="https://unpkg.com/@promises/every-parallel/fp/bundle.umd.min.js"></script>let {
__,
everyParallel
} = PF;Examples
let comparator = (value: any) => {
return Promise.resolve(Boolean(value))
};
let array: any[] = [true, 1, Promise.resolve(null), 'yes'];
everyParallel(comparator)(Infinity)(array).then((result: boolean)=>{
console.log(result) // result => false
});Wrapper
Module
$ npm install --save @promises/every-parallelimport Promises from '@promises/core';
import '@promises/every-parallel/add';Or
import Promises from '@promises/every-parallel/add';Browser
<script src="https://unpkg.com/@promises/core/bundle.umd.min.js"></script>
<script src="https://unpkg.com/@promises/every-parallel/add/bundle.umd.min.js"></script>let {
Promises
} = P;Examples
let comparator = (value) => {
return Promises.resolve(Boolean(value))
};
let array: any[] = [true, 1, Promises.resolve(null), 'yes'];
let promises: Promises<any[]> = Promises.resolve(array);
promises.everyParallel(comparator).then((result: boolean)=>{
console.log(result) // result => false
});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.