In contrast to the built-in Object.getOwnPropertyDescriptor(), this function returns null if provided undefined or null, rather than throwing an error.
In contrast to the built-in Object.getOwnPropertyDescriptor(), this function returns null if an object does not have an inherited provided property, rather than undefined.
throws
third argument must be a positive integer
Parameters
value: any
input object
property: string | symbol
property
Optional level: undefined | number
inheritance level
Returns
TypedPropertyDescriptor<any> | null
property descriptor or null
Example
var desc = inheritedPropertyDescriptor( {}, 'toString' );
// returns {...}
Returns a property descriptor for an object's inherited property.
Notes
Object.getOwnPropertyDescriptor()
, this function returnsnull
if providedundefined
ornull
, rather than throwing an error.Object.getOwnPropertyDescriptor()
, this function returnsnull
if an object does not have an inherited provided property, rather thanundefined
.third argument must be a positive integer