mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Cache property value.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user