• Given an object anObject and a key aKey, returns a boolean telling is this object effectively possesses this key as an attribute (in this function, objects are considered as a set of key-value pairs).

    Parameters

    • anObject: any

      the object to consider

    • aKey: string

      the key inside the object

    Returns boolean

    if anObject possesses a value associated to aKey

    hasKey({ x: 1 }, "y"); // -> false
    hasKey({ y: 1 }, "y"); // -> true