mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
lib: enforce use of Array from primordials
PR-URL: https://github.com/nodejs/node/pull/30635 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
48 files changed
+139
-68
No files matched your search
+4
-2
@@ -22,6 +22,8 @@
|
||||
'use strict';
|
||||
|
||||
const {
|
||||
Array,
|
||||
ArrayIsArray,
|
||||
MathFloor,
|
||||
MathMin,
|
||||
MathTrunc,
|
||||
@@ -483,7 +485,7 @@ function fromObject(obj) {
|
||||
return fromArrayLike(obj);
|
||||
}
|
||||
|
||||
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
|
||||
if (obj.type === 'Buffer' && ArrayIsArray(obj.data)) {
|
||||
return fromArrayLike(obj.data);
|
||||
}
|
||||
}
|
||||
@@ -518,7 +520,7 @@ Buffer[kIsEncodingSymbol] = Buffer.isEncoding;
|
||||
|
||||
Buffer.concat = function concat(list, length) {
|
||||
let i;
|
||||
if (!Array.isArray(list)) {
|
||||
if (!ArrayIsArray(list)) {
|
||||
throw new ERR_INVALID_ARG_TYPE('list', 'Array', list);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user