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) => any

    Returns the new accessor function.

    5.0.0

    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]