Skip to content

Commit

Permalink
[refactor] Fix a small typo and code styling (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhyukify authored and darrachequesne committed Nov 7, 2018
1 parent 6e40018 commit 48f340e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
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

0 comments on commit 48f340e

Please sign in to comment.