Skip to content

Instantly share code, notes, and snippets.

@bekzod
Created October 11, 2014 14:24
Show Gist options
  • Select an option

  • Save bekzod/ce3d22c985d79805f891 to your computer and use it in GitHub Desktop.

Select an option

Save bekzod/ce3d22c985d79805f891 to your computer and use it in GitHub Desktop.
var Step = require('step');
function someFunc(i, callback){
function cbWrapper(){ callback(undefined, i); }
i % 2 == 0 ? cbWrapper() : setTimeout(cbWrapper, 10);
}
Step(
function process(){
var group = this.group();
for(var i = 0; i < 10; i++){
someFunc(i, group() );
}
},
function end(err, data){
console.log(err || data);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment