Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Fix a small typo and code styling #88

Merged
merged 3 commits into from Nov 7, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Readme.md
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
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