-
-
Save robotlolita/9068d34aa4bc74a590d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
async.eachSeries(array, function(item, callback){ | |
callAsyncFunction(item, function(error, data) { | |
if (error) { | |
return callback(error); | |
} else { | |
async.eachSeries(arrayTwo, function(sItem, sCallback) { | |
count++; | |
callAnotherAsyncFunction(item + sItem, function(error, data) { | |
if (error) { | |
return callback(error); | |
} else { | |
sCallback(); | |
} | |
}) | |
}); | |
} | |
}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doSomething(item) { | |
return callAsyncFunction(item).then(function(data) { | |
return Promise.all(arrayTwo.map(sItem => doSomethingElse(item, sItem))); | |
}) | |
} | |
function doSomethingElse(item, sItem) { | |
count++; | |
return callAnotherAsyncFunction(item + sItem); | |
} | |
array.map(doSomething); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (let item of array) { | |
let x = await callAsyncFunction(item); | |
for (let sItem of arrayTwo) { | |
let y = await callAnotherAsyncFunction(item + sItem) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment