d11de17bf3aa6ce758469ad32f6471e01f0323ef
[yaffs-website] / node_modules / grunt-legacy-log-utils / node_modules / lodash / _baseGet.js
1 var baseToPath = require('./_baseToPath'),
2     isKey = require('./_isKey');
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 = isKey(path, object) ? [path + ''] : baseToPath(path);
14
15   var index = 0,
16       length = path.length;
17
18   while (object != null && index < length) {
19     object = object[path[index++]];
20   }
21   return (index && index == length) ? object : undefined;
22 }
23
24 module.exports = baseGet;