755fa05ae2d96f0f16281b5305ce74fa2273cb90
[yaffs-website] / node_modules / grunt-legacy-log-utils / node_modules / lodash / get.js
1 var baseGet = require('./_baseGet');
2
3 /**
4  * Gets the value at `path` of `object`. If the resolved value is
5  * `undefined` the `defaultValue` is used in its place.
6  *
7  * @static
8  * @memberOf _
9  * @category Object
10  * @param {Object} object The object to query.
11  * @param {Array|string} path The path of the property to get.
12  * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
13  * @returns {*} Returns the resolved value.
14  * @example
15  *
16  * var object = { 'a': [{ 'b': { 'c': 3 } }] };
17  *
18  * _.get(object, 'a[0].b.c');
19  * // => 3
20  *
21  * _.get(object, ['a', '0', 'b', 'c']);
22  * // => 3
23  *
24  * _.get(object, 'a.b.c', 'default');
25  * // => 'default'
26  */
27 function get(object, path, defaultValue) {
28   var result = object == null ? undefined : baseGet(object, path);
29   return result === undefined ? defaultValue : result;
30 }
31
32 module.exports = get;