Skip to content

Commit f4c80d7

Browse files
author
Ruben Bridgewater
committed
Simplify concat bulk string logic
1 parent 5e38565 commit f4c80d7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/parser.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,14 @@ function concatBulkString (parser) {
319319
if (chunks === 2) {
320320
return list[0].toString('utf8', parser.bigOffset, list[0].length - 1)
321321
}
322-
} else {
323-
chunks++
322+
chunks--
323+
offset = list[list.length - 2].length + 1
324324
}
325325
var res = decoder.write(list[0].slice(parser.bigOffset))
326-
for (var i = 1; i < chunks - 2; i++) {
326+
for (var i = 1; i < chunks - 1; i++) {
327327
res += decoder.write(list[i])
328328
}
329-
res += decoder.end(list[i].slice(0, offset === 1 ? list[i].length - 1 : offset - 2))
329+
res += decoder.end(list[i].slice(0, offset - 2))
330330
return res
331331
}
332332

0 commit comments

Comments
 (0)