* This method is like `_.get` except that if the resolved value is a function * it is invoked with the `this` binding of its parent object and its result * is returned. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query.
(object, path, defaultValue)
| 11284 | * // => 'default' |
| 11285 | */ |
| 11286 | function result(object, path, defaultValue) { |
| 11287 | var result = object == null ? undefined : object[path]; |
| 11288 | if (result === undefined) { |
| 11289 | if (object != null && !isKey(path, object)) { |
| 11290 | path = toPath(path); |
| 11291 | object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); |
| 11292 | result = object == null ? undefined : object[last(path)]; |
| 11293 | } |
| 11294 | result = result === undefined ? defaultValue : result; |
| 11295 | } |
| 11296 | return isFunction(result) ? result.call(object) : result; |
| 11297 | } |
| 11298 | |
| 11299 | /** |
| 11300 | * Sets the property value of `path` on `object`. If a portion of `path` |