1 var apply = require('./_apply'),
2 castPath = require('./_castPath'),
3 isKey = require('./_isKey'),
4 last = require('./last'),
5 parent = require('./_parent'),
6 toKey = require('./_toKey');
9 * The base implementation of `_.invoke` without support for individual
13 * @param {Object} object The object to query.
14 * @param {Array|string} path The path of the method to invoke.
15 * @param {Array} args The arguments to invoke the method with.
16 * @returns {*} Returns the result of the invoked method.
18 function baseInvoke(object, path, args) {
19 if (!isKey(path, object)) {
20 path = castPath(path);
21 object = parent(object, path);
24 var func = object == null ? object : object[toKey(path)];
25 return func == null ? undefined : apply(func, object, args);
28 module.exports = baseInvoke;