8000 Avoid issues with engines that can't manipulate `arguments` objects w… · lodash/lodash@36fcc46 · GitHub
[go: up one dir, main page]

Skip to content

Commit 36fcc46

Browse files
committed
Avoid issues with engines that can't manipulate arguments objects with array methods.
1 parent 24b03d4 commit 36fcc46

File tree

7 files changed

+52
-40
lines changed

7 files changed

+52
-40
lines changed

dist/lodash.compat.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,15 +1520,18 @@
15201520
var args = arguments,
15211521
thisBinding = isBind ? thisArg : this;
15221522

1523-
if (isPartial) {
1524-
unshift.apply(args, partialArgs);
1525-
}
1526-
if (isPartialRight) {
1527-
push.apply(args, partialRightArgs);
1528-
}
1529-
if (isCurry && args.length < arity) {
1530-
bitmask |= 16 & ~32;
1531-
return createBound(func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity);
1523+
if (isCurry || isPartial || isPartialRight) {
1524+
args = nativeSlice.call(args);
1525+
if (isPartial) {
1526+
unshift.apply(args, partialArgs);
1527+
}
1528+
if (isPartialRight) {
1529+
push.apply(args, partialRightArgs);
1530+
}
1531+
if (isCurry && args.length < arity) {
1532+
bitmask |= 16 & ~32;
1533+
return createBound(func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity);
1534+
}
15321535
}
15331536
if (isBindKey) {
15341537
func = thisBinding[key];

dist/lodash.compat.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lodash.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,15 +1251,18 @@
12511251
var args = arguments,
12521252
thisBinding = isBind ? thisArg : this;
12531253

1254-
if (isPartial) {
1255-
unshift.apply(args, partialArgs);
1256-
}
1257-
if (isPartialRight) {
1258-
push.apply(args, partialRightArgs);
1259-
}
1260-
if (isCurry && args.length < arity) {
1261-
bitmask |= 16 & ~32;
1262-
return createBound(func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity);
1254+
if (isCurry || isPartial || isPartialRight) {
1255+
args = nativeSlice.call(args);
1256+
if (isPartial) {
1257+
unshift.apply(args, partialArgs);
1258+
}
1259+
if (isPartialRight) {
1260+
push.apply(args, partialRightArgs);
1261+
}
1262+
if (isCurry && args.length < arity) {
1263+
bitmask |= 16 & ~32;
1264+
return createBound(func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity);
1265+
}
12631266
}
12641267
if (isBindKey) {
12651268
func = thisBinding[key];

dist/lodash.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lodash.underscore.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -666,15 +666,18 @@
666666
var args = arguments,
667667
thisBinding = isBind ? thisArg : this;
668668

669-
if (isPartial) {
670-
unshift.apply(args, partialArgs);
671-
}
672-
if (isPartialRight) {
673-
push.apply(args, partialRightArgs);
674-
}
675-
if (isCurry && args.length < arity) {
676-
bitmask |= 16 & ~32;
677-
return createBound(func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity);
669+
if (isCurry || isPartial || isPartialRight) {
670+
args = nativeSlice.call(args);
671+
if (isPartial) {
672+
unshift.apply(args, partialArgs);
673+
}
674+
if (isPartialRight) {
675+
push.apply(args, partialRightArgs);
676+
}
677+
if (isCurry && args.length < arity) {
678+
bitmask |= 16 & ~32;
679+
return createBound(func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity);
680+
}
678681
}
679682
if (isBindKey) {
680683
func = thisBinding[key];

dist/lodash.underscore.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lodash.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,15 +1539,18 @@
15391539
var args = arguments,
15401540
thisBinding = isBind ? thisArg : this;
15411541

1542-
if (isPartial) {
1543-
unshift.apply(args, partialArgs);
1544-
}
1545-
if (isPartialRight) {
1546-
push.apply(args, partialRightArgs);
1547-
}
1548-
if (isCurry && args.length < arity) {
1549-
bitmask |= 16 & ~32;
1550-
return createBound(func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity);
1542+
if (isCurry || isPartial || isPartialRight) {
1543+
args = nativeSlice.call(args);
1544+
if (isPartial) {
1545+
unshift.apply(args, partialArgs);
1546+
}
1547+
if (isPartialRight) {
1548+
push.apply(args, partialRightArgs);
1549+
}
1550+
if (isCurry && args.length < arity) {
1551+
bitmask |= 16 & ~32;
1552+
return createBound(func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity);
1553+
}
15511554
}
15521555
if (isBindKey) {
15531556
func = thisBinding[key];

0 commit comments

Comments
 (0)
0