• Returns whether the given object has the specified property

    Parameters

    • object: any

      the object to check

    • Optionalprop: null | string

      the property name to check

    Returns boolean

    whether the object has the specified property

    hasProp({foo: 'bar'}, 'foo');    // true
    hasProp({foo: 'bar'}, 'bar'); // false