-
Notifications
You must be signed in to change notification settings - Fork 9
kgo migration examples
Kory Nunn edited this page Jul 16, 2018
·
1 revision
The following kgo block:
kgo
('things', function(done){
//Something async
setTimeout(function(){
done(null, 1);
}, 100);
})
('stuff', function(done){
//Something async
setTimeout(function(){
done(null, 2);
}, 100);
})
('whatsits', ['things', 'stuff'], function(things, stuff, done){
//Something async
setTimeout(function(){
done(null, things + stuff);
}, 100);
})
('dooby', ['things'], function(things, done){
//Something async
setTimeout(function(){
done(null, things/2);
}, 100);
})
(['whatsits', 'dooby'], function(whatsits, dooby, done){
//Done
console.log(whatsits, dooby);
});
Is very similar in righto:
var things = righto(function(done){
//Something async
setTimeout(function(){
done(null, 1);
}, 100);
})
var stuff = righto(function(done){
//Something async
setTimeout(function(){
done(null, 2);
}, 100);
})
var whatsits = righto(function(things, stuff, done){
//Something async
setTimeout(function(){
done(null, things + stuff);
}, 100);
}, things, stuff)
var dooby = righto(function(things, done){
//Something async
setTimeout(function(){
done(null, things/2);
}, 100);
}, things)
var result = righto.mate(whatsits, dooby)
result(function(error, whatsits, dooby){
//Done
console.log(whatsits, dooby);
});