]> zoso.dev Git - buffer.git/commitdiff
Fixing the special case in Buffer.concat
authorFeross Aboukhadijeh <feross@feross.org>
Wed, 5 Aug 2015 08:41:09 +0000 (10:41 +0200)
committerFeross Aboukhadijeh <feross@feross.org>
Wed, 5 Aug 2015 08:41:09 +0000 (10:41 +0200)
See: https://github.com/nodejs/io.js/pull/1937

index.js
test/methods.js

index 7cd95fee978cef2e7503dfe3313f61040b01f2aa..10931c617919ac224c7be12b651d94bf0e04b907 100644 (file)
--- 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
index 4f997c0702674ae625350fee220392c346bfbcb1..b6b7c741d0d1062782ad5b38ae4afcd6075d6f15 100644 (file)
@@ -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()