tweaking invoke implementation

This commit is contained in:
Jeremy Ashkenas
2011-04-15 17:00:37 -04:00
2 changed files with 8 additions and 1 deletions

View File

@@ -208,7 +208,7 @@
_.invoke = function(obj, method) {
var args = slice.call(arguments, 2);
return _.map(obj, function(value) {
return (method ? value[method] : value).apply(value, args);
return (method.call ? method || value : value[method]).apply(value, args);
});
};