Object.prototype.hasOwnNestedProperty = function(propertyPath){
if (!propertyPath) {
return false;
}
let properties = propertyPath.split('.');
let self = this;
for (let i = 0; i < properties.length; i++) {
var prop = properties[i];
if (!self || !self.hasOwnProperty(prop)) {
return false;
} else {
self = self[prop];
}
}
return true;
};
let response = {data: {users: {}}}
response.hasOwnNestedProperty('data.users');