(object: object, key: string | symbol)
| 30 | * Checks if `hasOwnProperty(object, key)` up the prototype chain, stopping at `Object.prototype`. |
| 31 | */ |
| 32 | const hasPropertyInObject = (object: object, key: string | symbol): boolean => { |
| 33 | const shouldTerminate = |
| 34 | !object || typeof object !== 'object' || object === Object.prototype; |
| 35 | |
| 36 | if (shouldTerminate) { |
| 37 | return false; |
| 38 | } |
| 39 | |
| 40 | return ( |
| 41 | Object.prototype.hasOwnProperty.call(object, key) || |
| 42 | hasPropertyInObject(Object.getPrototypeOf(object), key) |
| 43 | ); |
| 44 | }; |
| 45 | |
| 46 | // Retrieves an object's keys for evaluation by getObjectSubset. This evaluates |
| 47 | // the prototype chain for string keys but not for non-enumerable symbols. |
no outgoing calls
no test coverage detected