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