remove uint8array check for now. minor style.

This commit is contained in:
Christopher Jeffrey 2015-12-18 22:57:10 -08:00
parent 8746248c2c
commit 7cae4c4eb5

View File

@ -57,8 +57,6 @@ Parser.prototype.feed = function feed(data) {
len = utils.copy(this.pending[0], chunk, off);
if (len === this.pending[0].length)
this.pending.shift();
else if (!this.pending[0].slice && this.pending[0] instanceof Uint8Array)
this.pending[0] = new Uint8Array(this.pending[0].buffer.slice(len));
else
this.pending[0] = this.pending[0].slice(len);
off += len;
@ -83,8 +81,7 @@ Parser.prototype.parse = function parse(chunk) {
if (readU32(utils.checksum(this.packet.payload)) !== this.packet.checksum)
return this._error('Invalid checksum');
this.packet.payload = this.parsePayload(this.packet.cmd,
this.packet.payload);
this.packet.payload = this.parsePayload(this.packet.cmd, this.packet.payload);
if (this.packet.payload)
this.emit('packet', this.packet);