Check if Object of Arrays is Empty in Javascript
The problem I had was an object with empty arrays in it. If I just checked if the Object is empty, I would’ve gotten a false, because there are arrays.
So we had to iterate through the object, and check if the length of the array is greater than 0. The some
function will return true as soon as any key returns greater than 0.
let obj = { a: [], b: [], c: [] } Object.keys(obj).some(key => obj[key].length !== 0)