tguard-js
    Preparing search index...

    Function hasOwn

    • Determines whether the provided value has an own property.

      Type Parameters

      • K extends PropertyKey

        The property key type expected to exist on the object.

      Parameters

      • obj: unknown

        The object to be used to check for an own property.

      • key: K

        The property key to be checked.

      Returns obj is Record<K, unknown>

      true if the value has an own property, otherwise false.

      This function is an alias for Object.prototype.hasOwnProperty but more robust.

      const obj = { a: 1 };
      hasOwn(obj, 'a'); // true
      hasOwn(obj, 'b'); // false

      1.0