Function getPropertyOwner

  • Returns the object that owns the final property resolved by a property path.

    The owner may be the object reached directly by the parent path or one of its prototypes. Intermediate values are read to continue traversal, but the final property value is not read. Set hasOwnOnly to true to require every segment, including the terminal property, to be owned directly by the value reached at that depth.

    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 object

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

    If options.hasOwnOnly is not a boolean.