_.result calls property with the correct context.

This commit is contained in:
Brad Dunbar
2012-03-21 06:33:37 -04:00
parent 594f1e2016
commit ebb9db4e8e
2 changed files with 3 additions and 3 deletions

View File

@@ -878,7 +878,7 @@
_.result = function(object, property) {
if (object == null) return null;
var value = object[property];
return _.isFunction(value) ? value() : value;
return _.isFunction(value) ? value.call(object) : value;
};
// Add your own custom functions to the Underscore object, ensuring that