Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#243·co

Be able to yield an iterable for parallel execution

Author: dashedCreated Sep 10, 2015Updated May 12, 2017

My usecase with collections from https://github.com/facebook/immutable-js:

javascript
co.wrap(function*(list) {

    // list is Immutable.Map

    const results = yield list.map(function(id) {
        return new Promise(function(resolve, reject) {
            // ...
        });
    }

    // ...
});

Source: tj/co

View original on GitHubView discussion on GitHub