Ensure func is a function before querying the weakmap. [closes #1319]

This commit is contained in:
jdalton
2015-07-06 08:23:11 -07:00
committed by John-David Dalton
parent a5e2caf40b
commit 2e50d11be5
2 changed files with 15 additions and 1 deletions

View File

@@ -3379,6 +3379,20 @@
fn = function(a, b) { return slice.call(arguments); },
isCurry = methodName == 'curry';
test('`_.' + methodName + '` should not error on functions with the same name as lodash methods', 1, function() {
function run(a, b) {
return a + b;
}
var curried = func(run);
try {
var actual = curried(1)(2);
} catch(e) {}
strictEqual(actual, 3);
});
test('`_.' + methodName + '` should work as an iteratee for methods like `_.map`', 2, function() {
var array = [fn, fn, fn],
object = { 'a': fn, 'b': fn, 'c': fn };