With this little snippet, you can easily check if the given object is empty or not. You may wrap it in a function to use it more globally.
let obj = {}; Object.getOwnPropertyNames(obj).length === 0; // let obj = {a: 'b'}; Object.getOwnPropertyNames(obj).length === 0; // Not Empty