Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

promise-series-map

ccwq4MIT1.0.0

串行执行promise列表的方法

readme

串行执行 function 列表 并收集结果

const wait = timeout => {
    return new Promise(resolve => {
        setTimeout(_=>{
            console.log(timeout);
            resolve(timeout);
        }, timeout);
    })
}

Promise.$map([
    _=>wait(1000),
    _=>wait(1800),
]).then(console.log)

// 10000
// 1800
// [1000, 1800]