I have next code and sequence in which it runs is incorrect:
async function getItems(table) {
return obj; // call 3, why it is called after module.exports and how to fix it
}
const {
var1,
var2
} = (async () => {
await getItems('env-variables-feature'); // call 1
})();
exports = {
status: var1,
something: var2
};
module.exports = exports; // call 2
As I know await means we should wait until function execute