Cache property value.

This commit is contained in:
Brad Dunbar
2012-03-19 14:24:59 -04:00
parent 666049ac5d
commit d0e7b397c1

View File

@@ -876,7 +876,8 @@
// Get a value from an object as a property or as a function.
_.getValue = function(object, prop) {
if (object == null) return null;
return _.isFunction(object[prop]) ? object[prop]() : object[prop];
var value = object[prop];
return _.isFunction(value) ? value() : value;
};
// Add your own custom functions to the Underscore object, ensuring that