BYVoid / continuation

JavaScript asynchronous Continuation-Passing Style transformation (deprecated).
Other
388 stars 42 forks source link

Add example for parallel array processing #9

Closed sudsy closed 11 years ago

sudsy commented 11 years ago

I can't seem to work out how to do the equivalent of

async.each https://github.com/caolan/async#eacharr-iterator-callback

or

async.map https://github.com/caolan/async#maparr-iterator-callback

Is there any chance of an example of something like that? These are the only use cases keeping my project dependant on the async library and I would love to remove that dependency if possible as I prefer the simplicity of the syntax when using your library and the robust error trapping.

BYVoid commented 11 years ago

Sorry, but there is not such a equivalent syntax of async.each in continuation.js. You have to use a for loop to iterate every element manually like below:

for (var i = 0; i < list.length; i++) {
  doSomethingAsync(list[i], obtain(data));
}

If you have further doubt, please kindly leave your comment.

sudsy commented 11 years ago

Thanks anyway,

This library has simplified my exception handling code dramatically and given me far less headaches too.

Cheers! On May 9, 2013 6:35 PM, "Carbo Kuo" notifications@github.com wrote:

Sorry, but there is not such a equivalent syntax of async.each in continuation.js. You have to use a for loop to iterate every element manually like below:

for (var i = 0; i < list.length; i++) { doSomethingAsync(list[i], obtain(data));}

If you have further doubt, please kindly leave your comment.

— Reply to this email directly or view it on GitHubhttps://github.com/BYVoid/continuation/issues/9#issuecomment-17654645 .