diff --git a/index.html b/index.html index f2a00cae3..7ebdc3f6e 100644 --- a/index.html +++ b/index.html @@ -1313,7 +1313,8 @@ _.escape('Curly, Larry & Moe');
result_.result(object, property)
- Returns a value from an object as a property or as a function.
+ If the value of the named property is a function then invoke it.
+ Otherwise, return its value.
var object = {cheese: 'crumpets', stuff: function(){ return 'nonsense'; }};
diff --git a/underscore.js b/underscore.js
index 6c9512594..429a9b142 100644
--- a/underscore.js
+++ b/underscore.js
@@ -873,7 +873,8 @@
return (''+string).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/');
};
- // Get a value from an object as a property or as a function.
+ // If the value of the named property is a function then invoke it.
+ // Otherwise, return its value.
_.result = function(object, property) {
if (object == null) return null;
var value = object[property];