Skip to content

Commit 58016e0

Browse files
Xavier-Redondotargos
authored andcommitted
tls: change loop var to let
PR-URL: #30445 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 7d113af commit 58016e0

2 files changed

Lines changed: 36 additions & 36 deletions

File tree

‎lib/internal/tls.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { Object } = primordials;
77
functionparseCertString(s){
88
constout=Object.create(null);
99
constparts=s.split('\n');
10-
for(vari=0,len=parts.length;i<len;i++){
10+
for(leti=0,len=parts.length;i<len;i++){
1111
constsepIndex=parts[i].indexOf('=');
1212
if(sepIndex>0){
1313
constkey=parts[i].slice(0,sepIndex);

‎lib/internal/url.js‎

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class URLSearchParams {
165165
// Need to use reflection APIs for full spec compliance.
166166
this[searchParams]=[];
167167
constkeys=Reflect.ownKeys(init);
168-
for(vari=0;i<keys.length;i++){
168+
for(leti=0;i<keys.length;i++){
169169
constkey=keys[i];
170170
constdesc=Reflect.getOwnPropertyDescriptor(init,key);
171171
if(desc!==undefined&&desc.enumerable){
@@ -203,7 +203,7 @@ class URLSearchParams {
203203

204204
constlist=this[searchParams];
205205
constoutput=[];
206-
for(vari=0;i<list.length;i+=2)
206+
for(leti=0;i<list.length;i+=2)
207207
output.push(`${innerInspect(list[i])} => ${innerInspect(list[i+1])}`);
208208

209209
constlength=output.reduce(
@@ -390,7 +390,7 @@ Object.defineProperties(URL.prototype, {
390390
...options
391391
};
392392
constctx=this[context];
393-
varret=ctx.scheme;
393+
letret=ctx.scheme;
394394
if(ctx.host!==null){
395395
ret+='//';
396396
consthas_username=ctx.username!=='';
@@ -539,7 +539,7 @@ Object.defineProperties(URL.prototype, {
539539
configurable: true,
540540
get(){
541541
constctx=this[context];
542-
varret=ctx.host||'';
542+
letret=ctx.host||'';
543543
if(ctx.port!==null)
544544
ret+=`:${ctx.port}`;
545545
returnret;
@@ -707,13 +707,13 @@ function initSearchParams(url, init) {
707707
// Ref: https://url.spec.whatwg.org/#concept-urlencoded-parser
708708
functionparseParams(qs){
709709
constout=[];
710-
varpairStart=0;
711-
varlastPos=0;
712-
varseenSep=false;
713-
varbuf='';
714-
varencoded=false;
715-
varencodeCheck=0;
716-
vari;
710+
letpairStart=0;
711+
letlastPos=0;
712+
letseenSep=false;
713+
letbuf='';
714+
letencoded=false;
715+
letencodeCheck=0;
716+
leti;
717717
for(i=0;i<qs.length;++i){
718718
constcode=qs.charCodeAt(i);
719719

@@ -834,7 +834,7 @@ function serializeParams(array) {
834834
constfirstEncodedValue=encodeStr(array[1],noEscape,paramHexTable);
835835
letoutput=`${firstEncodedParam}=${firstEncodedValue}`;
836836

837-
for(vari=2;i<len;i+=2){
837+
for(leti=2;i<len;i+=2){
838838
constencodedParam=encodeStr(array[i],noEscape,paramHexTable);
839839
constencodedValue=encodeStr(array[i+1],noEscape,paramHexTable);
840840
output+=`&${encodedParam}=${encodedValue}`;
@@ -876,7 +876,7 @@ function defineIDLClass(proto, classStr, obj) {
876876
functionmerge(out,start,mid,end,lBuffer,rBuffer){
877877
constsizeLeft=mid-start;
878878
constsizeRight=end-mid;
879-
varl,r,o;
879+
letl,r,o;
880880

881881
for(l=0;l<sizeLeft;l++)
882882
lBuffer[l]=out[start+l];
@@ -926,7 +926,7 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', {
926926

927927
constlist=this[searchParams];
928928
name=toUSVString(name);
929-
for(vari=0;i<list.length;){
929+
for(leti=0;i<list.length;){
930930
constcur=list[i];
931931
if(cur===name){
932932
list.splice(i,2);
@@ -947,7 +947,7 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', {
947947

948948
constlist=this[searchParams];
949949
name=toUSVString(name);
950-
for(vari=0;i<list.length;i+=2){
950+
for(leti=0;i<list.length;i+=2){
951951
if(list[i]===name){
952952
returnlist[i+1];
953953
}
@@ -966,7 +966,7 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', {
966966
constlist=this[searchParams];
967967
constvalues=[];
968968
name=toUSVString(name);
969-
for(vari=0;i<list.length;i+=2){
969+
for(leti=0;i<list.length;i+=2){
970970
if(list[i]===name){
971971
values.push(list[i+1]);
972972
}
@@ -984,7 +984,7 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', {
984984

985985
constlist=this[searchParams];
986986
name=toUSVString(name);
987-
for(vari=0;i<list.length;i+=2){
987+
for(leti=0;i<list.length;i+=2){
988988
if(list[i]===name){
989989
returntrue;
990990
}
@@ -1007,8 +1007,8 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', {
10071007
// If there are any name-value pairs whose name is `name`, in `list`, set
10081008
// the value of the first such name-value pair to `value` and remove the
10091009
// others.
1010-
varfound=false;
1011-
for(vari=0;i<list.length;){
1010+
letfound=false;
1011+
for(leti=0;i<list.length;){
10121012
constcur=list[i];
10131013
if(cur===name){
10141014
if(!found){
@@ -1042,10 +1042,10 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', {
10421042
// 100 is found through testing.
10431043
// Simple stable in-place insertion sort
10441044
// Derived from v8/src/js/array.js
1045-
for(vari=2;i<len;i+=2){
1046-
varcurKey=a[i];
1047-
varcurVal=a[i+1];
1048-
varj;
1045+
for(leti=2;i<len;i+=2){
1046+
constcurKey=a[i];
1047+
constcurVal=a[i+1];
1048+
letj;
10491049
for(j=i-2;j>=0;j-=2){
10501050
if(a[j]>curKey){
10511051
a[j+2]=a[j];
@@ -1061,10 +1061,10 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', {
10611061
// Bottom-up iterative stable merge sort
10621062
constlBuffer=newArray(len);
10631063
constrBuffer=newArray(len);
1064-
for(varstep=2;step<len;step*=2){
1065-
for(varstart=0;start<len-2;start+=2*step){
1066-
varmid=start+step;
1067-
varend=mid+step;
1064+
for(letstep=2;step<len;step*=2){
1065+
for(letstart=0;start<len-2;start+=2*step){
1066+
constmid=start+step;
1067+
letend=mid+step;
10681068
end=end<len ? end : len;
10691069
if(mid>end)
10701070
continue;
@@ -1097,7 +1097,7 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', {
10971097

10981098
letlist=this[searchParams];
10991099

1100-
vari=0;
1100+
leti=0;
11011101
while(i<list.length){
11021102
constkey=list[i];
11031103
constvalue=list[i+1];
@@ -1279,10 +1279,10 @@ const forwardSlashRegEx = /\//g;
12791279

12801280
functiongetPathFromURLWin32(url){
12811281
consthostname=url.hostname;
1282-
varpathname=url.pathname;
1283-
for(varn=0;n<pathname.length;n++){
1282+
letpathname=url.pathname;
1283+
for(letn=0;n<pathname.length;n++){
12841284
if(pathname[n]==='%'){
1285-
varthird=pathname.codePointAt(n+2)|0x20;
1285+
constthird=pathname.codePointAt(n+2)|0x20;
12861286
if((pathname[n+1]==='2'&&third===102)||// 2f 2F /
12871287
(pathname[n+1]==='5'&&third===99)){// 5c 5C \
12881288
thrownewERR_INVALID_FILE_URL_PATH(
@@ -1303,8 +1303,8 @@ function getPathFromURLWin32(url) {
13031303
return`\\\\${domainToUnicode(hostname)}${pathname}`;
13041304
}else{
13051305
// Otherwise, it's a local path that requires a drive letter
1306-
varletter=pathname.codePointAt(1)|0x20;
1307-
varsep=pathname[2];
1306+
constletter=pathname.codePointAt(1)|0x20;
1307+
constsep=pathname[2];
13081308
if(letter<CHAR_LOWERCASE_A||letter>CHAR_LOWERCASE_Z||// a..z A..Z
13091309
(sep!==':')){
13101310
thrownewERR_INVALID_FILE_URL_PATH('must be absolute');
@@ -1318,9 +1318,9 @@ function getPathFromURLPosix(url) {
13181318
thrownewERR_INVALID_FILE_URL_HOST(platform);
13191319
}
13201320
constpathname=url.pathname;
1321-
for(varn=0;n<pathname.length;n++){
1321+
for(letn=0;n<pathname.length;n++){
13221322
if(pathname[n]==='%'){
1323-
varthird=pathname.codePointAt(n+2)|0x20;
1323+
constthird=pathname.codePointAt(n+2)|0x20;
13241324
if(pathname[n+1]==='2'&&third===102){
13251325
thrownewERR_INVALID_FILE_URL_PATH(
13261326
'must not include encoded / characters'

0 commit comments

Comments
 (0)