From: Feross Aboukhadijeh Date: Mon, 20 Apr 2015 20:51:00 +0000 (-0700) Subject: match iojs Buffer.concat signature X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=0c465f0857f7875ae995896ac850fa0df4c637c7;p=buffer.git match iojs Buffer.concat signature --- diff --git a/index.js b/index.js index bbb7343..ba03fc2 100644 --- a/index.js +++ b/index.js @@ -178,7 +178,7 @@ Buffer.isEncoding = function isEncoding (encoding) { } } -Buffer.concat = function concat (list, totalLength) { +Buffer.concat = function concat (list, length) { if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.') if (list.length === 0) { @@ -188,14 +188,14 @@ Buffer.concat = function concat (list, totalLength) { } var i - if (totalLength === undefined) { - totalLength = 0 + if (length === undefined) { + length = 0 for (i = 0; i < list.length; i++) { - totalLength += list[i].length + length += list[i].length } } - var buf = new Buffer(totalLength) + var buf = new Buffer(length) var pos = 0 for (i = 0; i < list.length; i++) { var item = list[i]