Skip to content
Permalink
Browse files

lib: replace var with let/const

PR-URL: #30390
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
Tijl5 authored and MylesBorins committed Nov 12, 2019
1 parent cb3e008 commit a6625dd7b6f603b7fd603285af1f9044f6d1ab53
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/internal/encoding.js
@@ -36,7 +36,7 @@ const {
encodeUtf8String
} = internalBinding('buffer');

var Buffer;
let Buffer;
function lazyBuffer() {
if (Buffer === undefined)
Buffer = require('buffer').Buffer;
@@ -281,8 +281,8 @@ const encodings = new Map([
// Unfortunately, String.prototype.trim also removes non-ascii whitespace,
// so we have to do this manually
function trimAsciiWhitespace(label) {
var s = 0;
var e = label.length;
let s = 0;
let e = label.length;
while (s < e && (
label[s] === '\u0009' ||
label[s] === '\u000a' ||
@@ -378,7 +378,7 @@ function makeTextDecoderICU() {
if (enc === undefined)
throw new ERR_ENCODING_NOT_SUPPORTED(encoding);

var flags = 0;
let flags = 0;
if (options !== null) {
flags |= options.fatal ? CONVERTER_FLAGS_FATAL : 0;
flags |= options.ignoreBOM ? CONVERTER_FLAGS_IGNORE_BOM : 0;
@@ -406,7 +406,7 @@ function makeTextDecoderICU() {
}
validateArgument(options, 'object', 'options', 'Object');

var flags = 0;
let flags = 0;
if (options !== null)
flags |= options.stream ? 0 : CONVERTER_FLAGS_FLUSH;

@@ -422,7 +422,7 @@ function makeTextDecoderICU() {
}

function makeTextDecoderJS() {
var StringDecoder;
let StringDecoder;
function lazyStringDecoder() {
if (StringDecoder === undefined)
({ StringDecoder } = require('string_decoder'));
@@ -444,7 +444,7 @@ function makeTextDecoderJS() {
if (enc === undefined || !hasConverter(enc))
throw new ERR_ENCODING_NOT_SUPPORTED(encoding);

var flags = 0;
let flags = 0;
if (options !== null) {
if (options.fatal) {
throw new ERR_NO_ICU('"fatal" option');

0 comments on commit a6625dd

Please sign in to comment.
You can’t perform that action at this time.