4.17.11
3.10.1
2.4.2
1.3.1
_.methodOf(object, [args])
The opposite of _.method
; this method creates a function that invokes
the method at a given path of object
. Any additional arguments are
provided to the invoked method.
Since
3.7.0
Arguments
argument
object
[args]
type
Object
...*
description
The object to query.
The arguments to invoke the method with.
Returns
(array)
Example
var array = _.times(3, _.constant),
object = {
a: array,
b: array,
c: array,
};
_.map(
["a[2]", "c[0]"],
_.methodOf(object)
);
// => [2, 0]
_.map(
[
["a", "2"],
["c", "0"],
],
_.methodOf(object)
);
// => [2, 0]
var array = _.times(3, _.constant),
object = { a: array, b: array, c: array };
_.map(["a[2]", "c[0]"], _.methodOf(object));
// => [2, 0]
_.map(
[
["a", "2"],
["c", "0"],
],
_.methodOf(object)
);
// => [2, 0]