diff --git a/lodash.src.js b/lodash.src.js index 0d814704f..26f1a7511 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -3998,7 +3998,7 @@ * @returns {*} Returns the metadata for `func`. */ var getData = !metaMap ? noop : function(func) { - return metaMap.get(func); + return typeof func == 'function' ? metaMap.get(func) : undefined; }; /** diff --git a/test/test.js b/test/test.js index edcf5a7b3..cc8e76427 100644 --- a/test/test.js +++ b/test/test.js @@ -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 };