Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/property-descriptor/docs/types/index.d"

Index

Functions

Export assignment getOwnPropertyDescriptor

  • getOwnPropertyDescriptor(value: any, property: string | symbol): TypedPropertyDescriptor<any> | null
  • Returns a property descriptor for an object's own property.

    Notes

    • 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 a provided property, rather than undefined.

    Parameters

    • value: any

      input object

    • property: string | symbol

      property

    Returns TypedPropertyDescriptor < any > | null

    property descriptor or null

    Example

    var obj = {
        'beep': 'boop',
        'foo': 3.14
    };
    
    var desc = getOwnPropertyDescriptor( obj, 'foo' );
    // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14}