Skip to content

Commit

Permalink
Add support for _.invoke() to take function reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
aseemk committed Mar 25, 2011
1 parent de50fc4 commit 3f512c2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
38 changes: 19 additions & 19 deletions underscore-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (typeof method === "string" ? value[method] : method || value).apply(value, args);
});
};

Expand Down

0 comments on commit 3f512c2

Please sign in to comment.