Consider the code
let promiseEmployees;
const employeeFlag = DB.GetFromEMPDB(); // Goes to DAL and gets results
if (employeeFlag) {
promiseEmployees = async () => {
// Imp
// ...
// ...
// ...
};
}
Is it possible to rewrite this code in one line without writing literally the if (...) {...} ?
This should work the following way:
const promiseEmployees = !DB.GetFromEMPDB()
? undefined
: async () => {
// Imp
};