Use _.isFunction so ClojureScript doesn't break underscore

Clojurescript adds a call method to strings, so passing a string to
_.invoke produces the wrong behavior.
This commit is contained in:
fredericksgary
2011-12-22 14:21:28 -05:00
committed by Gary Fredericks
parent e58af52060
commit 2206092e25
2 changed files with 14 additions and 1 deletions

View File

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