Function hasProperty

  • check if object has a property

    Type Parameters

    • T
    • K extends string | number | symbol

    Parameters

    • object: T
    • property: K

      a property in the object.

    Returns void

    hasProperty({a: 1}, 'a');
    
  • check if object has a property with a specific value

    Type Parameters

    • T
    • K extends string | number | symbol

    Parameters

    • object: T
    • property: K

      a property in the object.

    • value: T[K]

    Returns void

    hasProperty({a: 1}, 'a', 1);