In my code, I deal with an array that has some entries with many objects nested inside one another, where as some do not. It looks something like the following:
If you are using lodash, you could use their "has" function. It is similar to the native "in", but allows paths.
var testObject = {a: {b: {c: 'walrus'}}}; if(_.has(testObject, 'a.b.c')) { //Safely access your walrus here }