Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var packet = {
encoder.encode(packet, function(encodedPackets) {
var decoder = new parser.Decoder();
decoder.on('decoded', function(decodedPacket) {
// decodedPacket.type == parser.BINARY_EVENTEVENT
// decodedPacket.type == parser.BINARY_EVENT
// Buffer.isBuffer(decodedPacket.data.i) == true
// Buffer.isBuffer(decodedPacket.data.j) == true
// decodedPacket.id == 15
Expand Down
8 changes: 3 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function Decoder() {
Emitter(Decoder.prototype);

/**
* Decodes an ecoded packet string into packet JSON.
* Decodes an encoded packet string into packet JSON.
*
* @param {String} obj - encoded packet
* @return {Object} packet
Expand All @@ -250,8 +250,7 @@ Decoder.prototype.add = function(obj) {
} else { // non-binary full packet
this.emit('decoded', packet);
}
}
else if (isBuf(obj) || obj.base64) { // raw binary data
} else if (isBuf(obj) || obj.base64) { // raw binary data
if (!this.reconstructor) {
throw new Error('got binary data when not reconstructing a packet');
} else {
Expand All @@ -261,8 +260,7 @@ Decoder.prototype.add = function(obj) {
this.emit('decoded', packet);
}
}
}
else {
} else {
throw new Error('Unknown type: ' + obj);
}
};
Expand Down