Skip to main content

methodOf

_.methodOf(object) # Ⓢ [Ⓣ][1] Ⓝ

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​

  1. object (Object): The object to query.

Returns​

(Function): Returns the new invoker function.

Example​

var array = _.times(_.constant, 3),
object = { 'a': array, 'b': array, 'c': array };

_.map(_.methodOf(object), ['a[2]', 'c[0]']);
// => [2, 0]

_.map(_.methodOf(object), [['a', '2'], ['c', '0']]);
// => [2, 0]