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

lib: remove string_decoder.js var redeclarations #4978

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/string_decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ StringDecoder.prototype.write = function(buffer) {
charStr = charBuffer.toString(encoding, 0, charLength);

// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
var charCode = charStr.charCodeAt(charStr.length - 1);
const charCode = charStr.charCodeAt(charStr.length - 1);
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
charLength += surrogateSize;
charStr = '';
Expand Down Expand Up @@ -128,8 +128,8 @@ StringDecoder.prototype.write = function(buffer) {
this.charLength = charLength;
charStr += buffer.toString(encoding, 0, end);

var end = charStr.length - 1;
var charCode = charStr.charCodeAt(end);
end = charStr.length - 1;
const charCode = charStr.charCodeAt(end);
// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
charLength += surrogateSize;
Expand Down