Skip to content

Commit 0471209

Browse files
author
Ruben Bridgewater
committed
Refactor some lines away
1 parent d754952 commit 0471209

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/parser.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ function JavascriptRedisParser (options) {
269269
JavascriptRedisParser.prototype.execute = function (buffer) {
270270
if (this.buffer === null) {
271271
this.buffer = buffer
272-
this.offset = 0
273272
} else if (this.bigStrSize === 0) {
274273
var oldLength = this.buffer.length
275274
var remainingLength = oldLength - this.offset
@@ -278,7 +277,6 @@ JavascriptRedisParser.prototype.execute = function (buffer) {
278277
this.buffer.copy(newBuffer, 0, this.offset, oldLength)
279278
buffer.copy(newBuffer, remainingLength, 0, buffer.length)
280279
this.buffer = newBuffer
281-
this.offset = 0
282280
} else if (this.totalChunkSize + buffer.length >= this.bigStrSize) {
283281
this.bufferCache.push(buffer)
284282
if (this.offset !== 0) {
@@ -288,16 +286,15 @@ JavascriptRedisParser.prototype.execute = function (buffer) {
288286
this.bigStrSize = 0
289287
this.totalChunkSize = 0
290288
this.bufferCache = []
291-
this.offset = 0
292289
} else {
293290
this.bufferCache.push(buffer)
294291
this.totalChunkSize += buffer.length
295292
return
296293
}
297294

298-
var length = this.buffer.length
295+
this.offset = 0
299296

300-
while (this.offset < length) {
297+
while (this.offset < this.buffer.length) {
301298
var offset = this.offset
302299
var type = this.buffer[this.offset++]
303300
var response = parseType(this, type)

0 commit comments

Comments
 (0)