Function default

  • The opposite of propertys method creates a function that returns the value at a given path of object.

    Parameters

    • object: any

      The object to query.

    Returns ((path) => any)

    Returns the new accessor function.

      • (path): any
      • Parameters

        • path: any

        Returns any

    Since

    5.0.0

    Example

    const array = [0, 1, 2]
    const object = { 'a': array, 'b': array, 'c': array }

    map(['a[2]', 'c[0]'], propertyOf(object))
    // => [2, 0]

    map([['a', '2'], ['c', '0']], propertyOf(object))
    // => [2, 0]