Object has-property-deep check in JavaScript