Function getPropertyDescriptor

  • Returns the own property descriptor that defines the final segment of a property path.

    Intermediate values are read as necessary to continue traversal, but the final property value is not read. Getter accessors at the terminal segment are therefore not invoked. When inherited lookup is enabled, the descriptor is returned from the prototype object that owns the final property.

    Parameters

    • data: object

      Object to inspect.

    • path: PropertyPath

      Dotted or exact property-key path.

    • Optionaloptions: { hasOwnOnly?: boolean }

      Property lookup options.

      • OptionalhasOwnOnly?: boolean

        Whether every path segment must be an own property; default: false.

    Returns PropertyDescriptor

    The terminal property descriptor, or undefined when the path cannot be resolved.

    If options.hasOwnOnly is not a boolean.