e47ebbfa2ca1928b909ce0a3fa4b22b9e63fd614
[yaffs-website] / node_modules / uncss / node_modules / lodash / internal / baseInvoke.js
1 var apply = require('./apply'),
2     baseToPath = require('./baseToPath'),
3     isKey = require('./isKey'),
4     last = require('../last'),
5     parent = require('./parent');
6
7 /**
8  * The base implementation of `_.invoke` without support for individual
9  * method arguments.
10  *
11  * @private
12  * @param {Object} object The object to query.
13  * @param {Array|string} path The path of the method to invoke.
14  * @param {Array} args The arguments to invoke the method with.
15  * @returns {*} Returns the result of the invoked method.
16  */
17 function baseInvoke(object, path, args) {
18   if (!isKey(path, object)) {
19     path = baseToPath(path);
20     object = parent(object, path);
21     path = last(path);
22   }
23   var func = object == null ? object : object[path];
24   return func == null ? undefined : apply(func, object, args);
25 }
26
27 module.exports = baseInvoke;