Permalink
Browse files

make callback optional

  • Loading branch information...
1 parent 5947d35 commit c2c45ea2e2d737b58ae31a2bcc1a6246d30717b5 @maxogden committed Aug 4, 2012
Showing with 4 additions and 4 deletions.
  1. +3 −3 index.js
  2. +1 −1 package.json
View
6 index.js
@@ -4,9 +4,9 @@ var util = require('util')
function ConcatStream(cb) {
stream.Stream.call(this)
this.writable = true
- this.cb = cb
+ if (cb) this.cb = cb
this.body = []
- this.on('error', cb)
+ if (this.cb) this.on('error', cb)
}
util.inherits(ConcatStream, stream.Stream)
@@ -38,7 +38,7 @@ ConcatStream.prototype.getBody = function () {
}
ConcatStream.prototype.end = function() {
- this.cb(false, this.getBody())
+ if (this.cb) this.cb(false, this.getBody())
}
module.exports = function(cb) {
View
2 package.json
@@ -1,7 +1,7 @@
{ "name" : "concat-stream"
, "description" : "writable stream that concatenates strings or data and calls a callback with the result"
, "tags" : ["stream", "simple", "util", "utility"]
-, "version" : "0.0.7"
+, "version" : "0.0.8"
, "author" : "Max Ogden <max@maxogden.com>"
, "repository" :
{ "type" : "git"

0 comments on commit c2c45ea

Please sign in to comment.