goldies
    Preparing search index...

    Function has

    • Return true, if target owns a property with the given key.

      Parameters

      • target: object

        The object to check.

      • key: string

        The key to check for.

      Returns boolean

      True if the target owns the property with the given key, otherwise false.

      const obj = { a: 1, b: 2 };
      has(obj, 'a'); // returns true
      has(obj, 'c'); // returns false

      Use the built-in Object.hasOwn(target, key), which this calls. Will be removed in goldies 6.0.