Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,12 @@ Buffer.isEncoding = function isEncoding(encoding) {
};
Buffer[kIsEncodingSymbol] = Buffer.isEncoding;

const kConcatErr = new errors.TypeError(
'ERR_INVALID_ARG_TYPE', 'list', ['Array', 'Buffer', 'Uint8Array']
);

Buffer.concat = function concat(list, length) {
var i;
if (!Array.isArray(list))
throw kConcatErr;
throw new errors.TypeError(
'ERR_INVALID_ARG_TYPE', 'list', ['Array', 'Buffer', 'Uint8Array']
);

if (list.length === 0)
return new FastBuffer();
Expand All @@ -472,7 +470,9 @@ Buffer.concat = function concat(list, length) {
for (i = 0; i < list.length; i++) {
var buf = list[i];
if (!isUint8Array(buf))
throw kConcatErr;
throw new errors.TypeError(
'ERR_INVALID_ARG_TYPE', 'list', ['Array', 'Buffer', 'Uint8Array']
);
_copy(buf, buffer, pos);
pos += buf.length;
}
Expand Down