Cleanup _.result.

This commit is contained in:
John-David Dalton
2014-02-05 21:31:56 -08:00
parent 8b4f1e1383
commit 20bf67d352

View File

@@ -7338,10 +7338,10 @@
* // => 'slate'
*/
function result(object, key, defaultValue) {
if (object == null || typeof object[key] == 'undefined') {
var value = object == null ? undefined : object[key];
if (typeof value == 'undefined') {
return defaultValue;
}
var value = object[key];
return isFunction(value) ? object[key]() : value;
}