This is a short version of my code.
var Promise = require('bluebird');
var fs = Promise.promisifyAll(require("fs"));
if (conditionA) {
fs.writeFileAsync(file, jsonData).then(function() {
return functionA();
});
} else {
functionA();
}
Both conditions call functionA
. Is there way to avoid else condition? I can do fs.writeFileSync
but I am looking for a non-blocking solution.