mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Ensure functions can be used as default values for _.result.
This commit is contained in:
@@ -7338,10 +7338,10 @@
|
||||
* // => 'slate'
|
||||
*/
|
||||
function result(object, key, defaultValue) {
|
||||
if (object == null) {
|
||||
if (object == null || typeof object[key] == 'undefined') {
|
||||
return defaultValue;
|
||||
}
|
||||
var value = typeof object[key] != 'undefined' ? object[key] : defaultValue;
|
||||
var value = object[key];
|
||||
return isFunction(value) ? object[key]() : value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user