Ensure getFuncName works when checking methods that shadow Object.prototype.

This commit is contained in:
Steven Sojka
2016-01-15 13:29:02 -06:00
committed by John-David Dalton
parent f6c6de40f1
commit 6949f71516
2 changed files with 13 additions and 1 deletions

View File

@@ -4678,7 +4678,7 @@
function getFuncName(func) {
var result = (func.name + ''),
array = realNames[result],
length = array ? array.length : 0;
length = hasOwnProperty.call(realNames, result) ? array.length : 0;
while (length--) {
var data = array[length],

View File

@@ -3475,6 +3475,18 @@
assert.deepEqual(c(3), expected);
assert.deepEqual(d(), expected);
});
QUnit.test('should work when a function name matches function name on Object.prototype', function(assert) {
assert.expect(1);
var curried = _.curry(function hasOwnProperty(a, b, c) {
return [a, b, c];
});
var expected = [1, 2, 3];
assert.deepEqual(curried(1)(2)(3), expected);
});
}());
/*--------------------------------------------------------------------------*/