mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Move internal modules to “internal” folder.
This commit is contained in:
24
.internal/baseInvoke.js
Normal file
24
.internal/baseInvoke.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import apply from './.internal/apply.js';
|
||||
import castPath from './.internal/castPath.js';
|
||||
import last from './last.js';
|
||||
import parent from './.internal/parent.js';
|
||||
import toKey from './.internal/toKey.js';
|
||||
|
||||
/**
|
||||
* The base implementation of `invoke` without support for individual
|
||||
* method arguments.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Array|string} path The path of the method to invoke.
|
||||
* @param {Array} args The arguments to invoke the method with.
|
||||
* @returns {*} Returns the result of the invoked method.
|
||||
*/
|
||||
function baseInvoke(object, path, args) {
|
||||
path = castPath(path, object);
|
||||
object = parent(object, path);
|
||||
const func = object == null ? object : object[toKey(last(path))];
|
||||
return func == null ? undefined : apply(func, object, args);
|
||||
}
|
||||
|
||||
export default baseInvoke;
|
||||
Reference in New Issue
Block a user