mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 19:37:49 +00:00
Add case of 5 to createCtorWrapper to align with bindCallback.
This commit is contained in:
@@ -3429,6 +3429,7 @@
|
|||||||
case 2: return new Ctor(args[0], args[1]);
|
case 2: return new Ctor(args[0], args[1]);
|
||||||
case 3: return new Ctor(args[0], args[1], args[2]);
|
case 3: return new Ctor(args[0], args[1], args[2]);
|
||||||
case 4: return new Ctor(args[0], args[1], args[2], args[3]);
|
case 4: return new Ctor(args[0], args[1], args[2], args[3]);
|
||||||
|
case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
|
||||||
}
|
}
|
||||||
var thisBinding = baseCreate(Ctor.prototype),
|
var thisBinding = baseCreate(Ctor.prototype),
|
||||||
result = Ctor.apply(thisBinding, args);
|
result = Ctor.apply(thisBinding, args);
|
||||||
|
|||||||
@@ -1510,11 +1510,12 @@
|
|||||||
|
|
||||||
test('should not error when calling bound class constructors', 1, function() {
|
test('should not error when calling bound class constructors', 1, function() {
|
||||||
var createCtor = _.attempt(Function, '"use strict";return class A{}');
|
var createCtor = _.attempt(Function, '"use strict";return class A{}');
|
||||||
|
|
||||||
if (typeof createCtor == 'function') {
|
if (typeof createCtor == 'function') {
|
||||||
var bound = _.bind(createCtor()),
|
var bound = _.bind(createCtor()),
|
||||||
expected = _.times(5, _.constant(true));
|
expected = _.times(6, _.constant(true));
|
||||||
|
|
||||||
var actual = _.times(5, function(index) {
|
var actual = _.times(6, function(index) {
|
||||||
try {
|
try {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: return !!(new bound);
|
case 0: return !!(new bound);
|
||||||
@@ -1522,6 +1523,7 @@
|
|||||||
case 2: return !!(new bound(1, 2));
|
case 2: return !!(new bound(1, 2));
|
||||||
case 3: return !!(new bound(1, 2, 3));
|
case 3: return !!(new bound(1, 2, 3));
|
||||||
case 4: return !!(new bound(1, 2, 3, 4));
|
case 4: return !!(new bound(1, 2, 3, 4));
|
||||||
|
case 5: return !!(new bound(1, 2, 3, 4, 5));
|
||||||
}
|
}
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user