You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

21 lines
375 B

'use strict';
var asyncDone = require('async-done');
function settle(fn, done) {
asyncDone(fn, function(error, result) {
var settled = {};
if (error != null) {
settled.state = 'error';
settled.value = error;
} else {
settled.state = 'success';
settled.value = result;
}
done(null, settled);
});
}
module.exports = settle;