Skip to content

Commit 1277db0

Browse files
committed
cleanups
1 parent f2be6e3 commit 1277db0

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lib/ddp-client.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ DDPClient = function(opts) {
3131

3232
// Expose EJSON object, so client can use EJSON.addType(...)
3333
if (self.use_ejson)
34-
self.EJSON = EJSON
34+
self.EJSON = EJSON;
3535

3636
// very very simple collections (name -> [{id -> document}])
3737
if (self.maintain_collections)
@@ -107,13 +107,7 @@ DDPClient.prototype._send = function(data) {
107107
DDPClient.prototype._message = function(data) {
108108
var self = this;
109109

110-
// XXX: In theory data could be a Buffer (for binary frames), perhaps when
111-
// there is streaming over DDP. We should check that data is a String.
112-
if (self.use_ejson) {
113-
data = EJSON.parse(data);
114-
} else {
115-
data = JSON.parse(data);
116-
}
110+
data = self.use_ejson ? EJSON.parse(data) : JSON.parse(data);
117111

118112
// TODO: 'addedBefore' -- not yet implemented in Meteor
119113
// TODO: 'movedBefore' -- not yet implemented in Meteor
@@ -225,7 +219,7 @@ DDPClient.prototype._message = function(data) {
225219
// minimal heartbeat response for ddp pre2
226220
} else if (data.msg === 'ping') {
227221
self._send(
228-
_.has(data, "id") ? { msg : 'pong', id : data.id } : { msg : 'pong' }
222+
_.has(data, 'id') ? { msg : 'pong', id : data.id } : { msg : 'pong' }
229223
);
230224
}
231225
};

0 commit comments

Comments
 (0)