| 1 |
var baseInvoke = require('./_baseInvoke'), |
| 2 |
baseRest = require('./_baseRest'); |
| 3 |
|
| 4 |
/** |
| 5 |
* Invokes the method at `path` of `object`. |
| 6 |
* |
| 7 |
* @static |
| 8 |
* @memberOf _ |
| 9 |
* @since 4.0.0 |
| 10 |
* @category Object |
| 11 |
* @param {Object} object The object to query. |
| 12 |
* @param {Array|string} path The path of the method to invoke. |
| 13 |
* @param {...*} [args] The arguments to invoke the method with. |
| 14 |
* @returns {*} Returns the result of the invoked method. |
| 15 |
* @example |
| 16 |
* |
| 17 |
* var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; |
| 18 |
* |
| 19 |
* _.invoke(object, 'a[0].b.c.slice', 1, 3); |
| 20 |
* // => [2, 3] |
| 21 |
*/ |
| 22 |
var invoke = baseRest(baseInvoke); |
| 23 |
|
| 24 |
module.exports = invoke; |