1 var baseGet = require('../internal/baseGet'),
2 toPath = require('../internal/toPath');
5 * Gets the property value at `path` of `object`. If the resolved value is
6 * `undefined` the `defaultValue` is used in its place.
11 * @param {Object} object The object to query.
12 * @param {Array|string} path The path of the property to get.
13 * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
14 * @returns {*} Returns the resolved value.
17 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
19 * _.get(object, 'a[0].b.c');
22 * _.get(object, ['a', '0', 'b', 'c']);
25 * _.get(object, 'a.b.c', 'default');
28 function get(object, path, defaultValue) {
29 var result = object == null ? undefined : baseGet(object, toPath(path), (path + ''));
30 return result === undefined ? defaultValue : result;