instead of wrapping all the code with conditions, think about having the business code on top level
"guard clauses" prevent you from this
// wrapping callback based functions (parameter is a callback) with promisesreturnnewPromise((resolve, reject)=>{cbFunction((data, error)=>{if(error){// "guard clause"returnreject(error);// "early out"}returnresolve(data);})});