mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
Ensure getFuncName works when checking methods that shadow Object.prototype.
This commit is contained in:
committed by
John-David Dalton
parent
f6c6de40f1
commit
6949f71516
@@ -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],
|
||||
|
||||
12
test/test.js
12
test/test.js
@@ -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);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user