1 var invokePath = require('../internal/invokePath'),
2 restParam = require('../function/restParam');
5 * The opposite of `_.method`; this method creates a function which invokes
6 * the method at a given path on `object`.
11 * @param {Object} object The object to query.
12 * @returns {Function} Returns the new function.
15 * var array = _.times(3, _.constant),
16 * object = { 'a': array, 'b': array, 'c': array };
18 * _.map(['a[2]', 'c[0]'], _.methodOf(object));
21 * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
24 var methodOf = restParam(function(object, args) {
25 return function(path) {
26 return invokePath(object, path, args);
30 module.exports = methodOf;