Ensure we use an underscore build of _.result.

This commit is contained in:
John-David Dalton
2014-01-19 12:28:25 -08:00
parent 677fb93494
commit cad0f1f396
2 changed files with 8 additions and 10 deletions

View File

@@ -4866,12 +4866,11 @@
* _.result(object, 'employer', 'slate');
* // => 'slate'
*/
function result(object, key, defaultValue) {
if (object == null) {
return defaultValue;
function result(object, key) {
if (object != null) {
var value = object[key];
return isFunction(value) ? object[key]() : value;
}
var value = typeof object[key] != 'undefined' ? object[key] : defaultValue;
return isFunction(value) ? object[key]() : value;
}
/**