Permalink
Browse files

Fixed a bug with the utf8 word "Array" in a buffer causing a crash.

  • Loading branch information...
1 parent d48c1c3 commit 6811c885d46a14d11cf115fcac6cdc47eddf81fc @daxxog daxxog committed Jan 26, 2013
Showing with 4 additions and 6 deletions.
  1. +1 −3 index.js
  2. +3 −3 test.js
View
@@ -26,9 +26,7 @@ ConcatStream.prototype.arrayConcat = function(arrs) {
}
ConcatStream.prototype.isArray = function(arr) {
- var isArray = Array.isArray(arr)
- var isTypedArray = arr.toString().match(/Array/)
- return isArray || isTypedArray
+ return Array.isArray(arr)
}
ConcatStream.prototype.getBody = function () {
View
@@ -19,10 +19,10 @@ arrays.end()
// buffer stream
var buffers = concat(function(err, out) {
- console.log('buffers', err, out)
+ console.log('buffers', err, out.toString())
})
-buffers.write(new Buffer('pizza '))
-buffers.write(new Buffer('cats'))
+buffers.write(new Buffer('pizza Array is not a ', 'utf8'))
+buffers.write(new Buffer('stringy cat'))
buffers.end()
// string stream

0 comments on commit 6811c88

Please sign in to comment.