mirror of https://github.com/nodejs/node.git
lib: remove string_decoder.js var redeclarations
PR-URL: https://github.com/nodejs/node/pull/4978 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
ba81d152ec
commit
68a6abc806
|
@ -96,7 +96,7 @@ StringDecoder.prototype.write = function(buffer) {
|
||||||
charStr = charBuffer.toString(encoding, 0, charLength);
|
charStr = charBuffer.toString(encoding, 0, charLength);
|
||||||
|
|
||||||
// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
|
// 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) {
|
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
||||||
charLength += surrogateSize;
|
charLength += surrogateSize;
|
||||||
charStr = '';
|
charStr = '';
|
||||||
|
@ -128,8 +128,8 @@ StringDecoder.prototype.write = function(buffer) {
|
||||||
this.charLength = charLength;
|
this.charLength = charLength;
|
||||||
charStr += buffer.toString(encoding, 0, end);
|
charStr += buffer.toString(encoding, 0, end);
|
||||||
|
|
||||||
var end = charStr.length - 1;
|
end = charStr.length - 1;
|
||||||
var charCode = charStr.charCodeAt(end);
|
const charCode = charStr.charCodeAt(end);
|
||||||
// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
|
// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
|
||||||
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
||||||
charLength += surrogateSize;
|
charLength += surrogateSize;
|
||||||
|
|
Loading…
Reference in New Issue