Function default

  • Checks if path is a direct or inherited property of object.

    Parameters

    • object: any

      The object to query.

    • key: any

      The key to check.

    Returns boolean

    Returns true if key exists, else false.

    Since

    5.7.0

    See

    [[has]],[[hasPath]],[[hasPathIn]]

    Example

    const object = create({ 'a': create({ 'b': 2 }) })

    hasIn(object, 'a')
    // => true

    hasIn(object, 'b')
    // => false