All new
alle new
This commit is contained in:
1 parent
da64472251
commit
5b20adee48
1605 files changed
+396517
-1674
No files matched your search
+10
-3
@@ -329,7 +329,7 @@ var isBuffer = function isBuffer(obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
||||
return !!(obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj));
|
||||
};
|
||||
|
||||
var combine = function combine(a, b, arrayLimit, plainObjects, throwOnLimitExceeded) {
|
||||
@@ -338,8 +338,15 @@ var combine = function combine(a, b, arrayLimit, plainObjects, throwOnLimitExcee
|
||||
if (throwOnLimitExceeded) {
|
||||
throw new RangeError('Array limit exceeded. Only ' + arrayLimit + ' element' + (arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
||||
}
|
||||
var newIndex = getMaxIndex(a) + 1;
|
||||
a[newIndex] = b;
|
||||
// spread `b` one level, matching the `[].concat(a, b)` used below, so a
|
||||
// collection appended to an already-overflowed object is flattened
|
||||
// rather than nested under a single index
|
||||
var bValues = isArray(b) ? b : [b];
|
||||
var newIndex = getMaxIndex(a);
|
||||
for (var i = 0; i < bValues.length; ++i) {
|
||||
newIndex += 1;
|
||||
a[newIndex] = bValues[i];
|
||||
}
|
||||
setMaxIndex(a, newIndex);
|
||||
return a;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user