I have an object that has other objects inside it up to n levels. I want to check if the object only contains other objects. Like this:
var emptyObj = {
obj1 : {
obj1a : {},
obj1b : {}
},
obj2 : {},
obj3 : {
obj3a : {
obj3aa : {}
}
}
};
Changing the data structure is not an option. No jQuery.
-- edit--
If there is anything apart from an empty object {} at the last level, the test should fail.
Failure examples:
var notEmpty1 = {
obj1 : []
};
var notEmpty2 = {
obj1: {
obj1a: ""
},
obj2: {}
};
functionbut I don't understand the question