@yunfly/chunk-promise
v1.0.8
Published
This module breaks the Promise into chunks and executes it in turn
Downloads
22
Readme
chunk-promise
这个模块将Promise分成多个块,并依次执行它
This module breaks the Promise into chunks and executes it in turn
Install
npm i @yunfly/chunk-promise
USE
import { chunkPromise } from '../lib/index';
var promises = [
() => Promise.resolve('a'),
() => Promise.resolve('b'),
() => Promise.resolve('c'),
() => Promise.resolve('d'),
() => Promise.resolve('e'),
() => Promise.resolve('f'),
() => Promise.resolve('g'),
]
chunkPromise(promises, 2)
.then(results => {
// ["a", "b", "c", "d", "e", "f", "g"]
// do something
});