Comparing version 0.4.3 to 0.4.4
@@ -18,5 +18,5 @@ #!/usr/bin/env node | ||
var parser = new stream.Transform({objectMode: true}); | ||
parser._transform = function _transform (obj, output, done) { | ||
parser._transform = function _transform (obj, encoding, done) { | ||
var str = obj.from + " says: " + obj.message + "\n"; | ||
output(str); | ||
this.push(str); | ||
done(); | ||
@@ -23,0 +23,0 @@ }; |
@@ -7,4 +7,4 @@ var Encoder = exports.Encoder = require("./encoder"), | ||
exports.wrap = function wrap(stream) { | ||
var enc = new Encoder(); | ||
var dec = new Decoder(); | ||
var enc = new Encoder(), | ||
dec = new Decoder(); | ||
@@ -11,0 +11,0 @@ // pipe burro streams |
@@ -9,5 +9,5 @@ var stream = require("stream"), | ||
Decoder.prototype._transform = function _transform(chunk, output, done) { | ||
Decoder.prototype._transform = function _transform(chunk, encoding, done) { | ||
try { | ||
output(JSON.parse(chunk.toString("utf8"))); | ||
this.push(JSON.parse(chunk.toString("utf8"))); | ||
} | ||
@@ -14,0 +14,0 @@ catch (error) { |
@@ -9,5 +9,5 @@ var stream = require("stream"), | ||
Encoder.prototype._transform = function _transform(obj, output, callback) { | ||
output(JSON.stringify(obj)); | ||
Encoder.prototype._transform = function _transform(obj, encoding, callback) { | ||
this.push(JSON.stringify(obj)); | ||
callback(null); | ||
}; |
@@ -9,3 +9,3 @@ var stream = require("stream"), | ||
Framer.prototype._transform = function _transform(chunk, output, callback) { | ||
Framer.prototype._transform = function _transform(chunk, encoding, callback) { | ||
// <Buffer 0 0 0 0 0 0 0 0 0 0 0 0> | ||
@@ -22,3 +22,3 @@ var buf = new Buffer(chunk.length + 4); | ||
this.emit("packet", buf); | ||
output(buf); | ||
this.push(buf); | ||
@@ -25,0 +25,0 @@ // return |
@@ -11,3 +11,3 @@ var stream = require("stream"), | ||
Unframer.prototype._transform = function _transform(chunk, output, done) { | ||
Unframer.prototype._transform = function _transform(chunk, encoding, done) { | ||
// append | ||
@@ -28,3 +28,3 @@ this._buffer = Buffer.concat([this._buffer, chunk]); | ||
else if (typeof this._length === "number" && this._buffer.length >= this._length) { | ||
output(this._buffer.slice(0, this._length)); | ||
this.push(this._buffer.slice(0, this._length)); | ||
this._buffer = this._buffer.slice(this._length); | ||
@@ -31,0 +31,0 @@ this._length = null; |
{ | ||
"name": "burro", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "auto-packaged, length-prefixed JSON byte streams", | ||
@@ -20,3 +20,3 @@ "main": "lib/burro", | ||
"engines": { | ||
"node": "~0.9" | ||
"node": "~0.9.12" | ||
}, | ||
@@ -23,0 +23,0 @@ "author": "Naomi Kyoto <nakyoto@gmail.com>", |
@@ -25,5 +25,5 @@ Burro | ||
var parser = new stream.Transform({objectMode: true}); | ||
parser._transform = function _transform (obj, output, done) { | ||
parser._transform = function _transform (obj, encoding, done) { | ||
var str = obj.from + " says: " + obj.message + "\n"; | ||
output(str); | ||
this.push(str); | ||
done(); | ||
@@ -30,0 +30,0 @@ }; |
@@ -74,2 +74,3 @@ var stream = require("stream"), | ||
// ?! it echoes to everyone! | ||
dummies[0].client.chat("hello server!"); |
@@ -19,3 +19,3 @@ var assert = require("assert"), | ||
var expected = "hello world"; | ||
alice._write = function(obj, _) { | ||
alice._write = function(obj, encoding, _) { | ||
assert.strictEqual(obj, expected); | ||
@@ -29,3 +29,3 @@ done(); | ||
var expected = {a: "a", b: "b"}; | ||
alice._write = function(obj, _) { | ||
alice._write = function(obj, encoding, _) { | ||
assert.deepEqual(obj, expected); | ||
@@ -45,3 +45,3 @@ done(); | ||
}; | ||
alice._write = function(obj, _) { | ||
alice._write = function(obj, encoding, _) { | ||
assert.deepEqual(obj, expected); | ||
@@ -59,3 +59,3 @@ done(); | ||
]; | ||
alice._write = function(obj, _done) { | ||
alice._write = function(obj, encoding, _done) { | ||
assert.deepEqual(obj, expected.shift()); | ||
@@ -74,3 +74,3 @@ _done(); | ||
var expected = "どうもありがとう"; | ||
alice._write = function(obj, _) { | ||
alice._write = function(obj, encoding, _) { | ||
assert.strictEqual(obj, expected); | ||
@@ -84,3 +84,3 @@ done(); | ||
var expected; | ||
alice._write = function(obj, _) { | ||
alice._write = function(obj, encoding, _) { | ||
assert.strictEqual(obj, expected); | ||
@@ -87,0 +87,0 @@ done(); |
@@ -21,3 +21,3 @@ var assert = require("assert"), | ||
var expected = Buffer([255,255,255,255]); | ||
writable._write = function(chunk, _) { | ||
writable._write = function(chunk, encoding, _) { | ||
assert.deepEqual(chunk, expected); | ||
@@ -31,3 +31,3 @@ done(); | ||
var expected = Buffer([255,255,255,255]); | ||
writable._write = function(chunk, _) { | ||
writable._write = function(chunk, encoding, _) { | ||
assert.deepEqual(chunk, expected); | ||
@@ -49,3 +49,3 @@ done(); | ||
]; | ||
writable._write = function _write(chunk, callback) { | ||
writable._write = function _write(chunk, encoding, callback) { | ||
assert.deepEqual(chunk, expected.shift()); | ||
@@ -52,0 +52,0 @@ callback(null); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16107
472