diff --git a/lodash.js b/lodash.js index 4d800bb6e..1a8d099a2 100644 --- a/lodash.js +++ b/lodash.js @@ -1550,11 +1550,8 @@ function isEqual(a, b, callback, thisArg, stackA, stackB) { // used to indicate that when comparing objects, `a` has at least the properties of `b` var whereIndicator = callback === indicatorObject; - if (callback && !whereIndicator) { - callback = (typeof thisArg == 'undefined') - ? callback - : lodash.createCallback(callback, thisArg, 2); - + if (typeof callback == 'function' && !whereIndicator) { + callback = lodash.createCallback(callback, thisArg, 2); var result = callback(a, b); if (typeof result != 'undefined') { return !!result; diff --git a/test/test.js b/test/test.js index 3214eb544..44c707979 100644 --- a/test/test.js +++ b/test/test.js @@ -1386,6 +1386,14 @@ strictEqual(actual, false); }); }); + + test('should ensure `callback` is a function', function() { + var array = [1, 2, 3], + eq = _.partial(_.isEqual, array), + actual = _.every([array, [1, 0, 3]], eq); + + strictEqual(actual, false); + }) }()); /*--------------------------------------------------------------------------*/