Last change
on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
789 bytes
|
Line | |
---|
1 | var apply = require('./_apply'),
|
---|
2 | castPath = require('./_castPath'),
|
---|
3 | last = require('./last'),
|
---|
4 | parent = require('./_parent'),
|
---|
5 | toKey = require('./_toKey');
|
---|
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 | path = castPath(path, object);
|
---|
19 | object = parent(object, path);
|
---|
20 | var func = object == null ? object : object[toKey(last(path))];
|
---|
21 | return func == null ? undefined : apply(func, object, args);
|
---|
22 | }
|
---|
23 |
|
---|
24 | module.exports = baseInvoke;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.