From: Feross Aboukhadijeh Date: Wed, 5 Aug 2015 08:41:09 +0000 (+0200) Subject: Fixing the special case in Buffer.concat X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=97ecf4c599de256fac994910d60c42dbc9baf2a3;p=buffer.git Fixing the special case in Buffer.concat See: https://github.com/nodejs/io.js/pull/1937 --- diff --git a/index.js b/index.js index 7cd95fe..10931c6 100644 --- a/index.js +++ b/index.js @@ -285,8 +285,6 @@ Buffer.concat = function concat (list, length) { if (list.length === 0) { return new Buffer(0) - } else if (list.length === 1) { - return list[0] } var i diff --git a/test/methods.js b/test/methods.js index 4f997c0..b6b7c74 100644 --- a/test/methods.js +++ b/test/methods.js @@ -55,7 +55,7 @@ test('concat() a varying number of buffers', function (t) { t.equal(flatZero.length, 0) t.equal(flatOne.toString(), 'asdf') - t.equal(flatOne, one[0]) + t.deepEqual(flatOne, one[0]) t.equal(flatLong.toString(), (new Array(10 + 1).join('asdf'))) t.equal(flatLongLen.toString(), (new Array(10 + 1).join('asdf'))) t.end()