main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
614 bytes
|
Line | |
---|
1 | import castPath from './_castPath.js';
|
---|
2 | import toKey from './_toKey.js';
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * The base implementation of `_.get` without support for default values.
|
---|
6 | *
|
---|
7 | * @private
|
---|
8 | * @param {Object} object The object to query.
|
---|
9 | * @param {Array|string} path The path of the property to get.
|
---|
10 | * @returns {*} Returns the resolved value.
|
---|
11 | */
|
---|
12 | function baseGet(object, path) {
|
---|
13 | path = castPath(path, object);
|
---|
14 |
|
---|
15 | var index = 0,
|
---|
16 | length = path.length;
|
---|
17 |
|
---|
18 | while (object != null && index < length) {
|
---|
19 | object = object[toKey(path[index++])];
|
---|
20 | }
|
---|
21 | return (index && index == length) ? object : undefined;
|
---|
22 | }
|
---|
23 |
|
---|
24 | export default baseGet;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.