Skip to content

Commit 7ed7b22

Browse files
BridgeARaddaleax
authored andcommitted
tools: change var to const in ./license2rtf
PR-URL: #13732 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
1 parent f3bff93 commit 7ed7b22

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

‎tools/license2rtf.js‎

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function LineSplitter(){
1616
this.writable=true;
1717

1818
this.write=function(data){
19-
varlines=(buffer+data).split(/\r\n|\n\r|\n|\r/);
19+
constlines=(buffer+data).split(/\r\n|\n\r|\n|\r/);
2020
for(vari=0;i<lines.length-1;i++){
2121
self.emit('data',lines[i]);
2222
}
@@ -128,18 +128,18 @@ function ParagraphParser(){
128128
}
129129

130130
// Find out indentation level and the start of a lied or numbered list;
131-
varresult=/^(\s*)(\d+\.|\*|-)?\s*/.exec(line);
131+
constresult=/^(\s*)(\d+\.|\*|-)?\s*/.exec(line);
132132
assert.ok(result);
133133
// The number of characters that will be stripped from the beginning of
134134
// the line.
135-
varline_strip_length=result[0].length;
135+
constline_strip_length=result[0].length;
136136
// The indentation size that will be used to detect indentation jumps.
137137
// Fudge by 1 space.
138-
varline_indent=Math.floor(result[0].length/2)*2;
138+
constline_indent=Math.floor(line_strip_length/2)*2;
139139
// The indentation level that will be exported
140-
varlevel=Math.floor(result[1].length/2);
140+
constlevel=Math.floor(result[1].length/2);
141141
// The list indicator that precedes the actual content, if any.
142-
varline_li=result[2];
142+
constline_li=result[2];
143143

144144
// Flush the paragraph when there is a li or an indentation jump
145145
if(line_li||(line_indent!==paragraph_line_indent&&
@@ -175,14 +175,14 @@ inherits(ParagraphParser, Stream);
175175
* replaces multiple consecutive whitespace characters by a single one.
176176
*/
177177
functionUnwrapper(){
178-
varself=this;
178+
constself=this;
179179

180180
Stream.call(this);
181181
this.writable=true;
182182

183183
this.write=function(paragraph){
184-
varlines=paragraph.lines;
185-
varbreak_after=[];
184+
constlines=paragraph.lines;
185+
constbreak_after=[];
186186
vari;
187187

188188
for(i=0;i<lines.length-1;i++){
@@ -236,15 +236,14 @@ function RtfGenerator(){
236236
Stream.call(this);
237237
this.writable=true;
238238

239-
this.write=function(paragraph){
239+
this.write=function({ li, level, lines,in_license_block: lic}){
240240
if(!did_write_anything){
241241
emitHeader();
242242
did_write_anything=true;
243243
}
244244

245-
varli=paragraph.li;
246-
varlevel=paragraph.level+(li ? 1 : 0);
247-
varlic=paragraph.in_license_block;
245+
if(li)
246+
level++;
248247

249248
varrtf='\\pard';
250249
rtf+='\\sa150\\sl300\\slmult1';
@@ -261,7 +260,7 @@ function RtfGenerator(){
261260
if(li)
262261
rtf+=' '+li+'\\tab';
263262
rtf+=' ';
264-
rtf+=paragraph.lines.map(rtfEscape).join('\\line ');
263+
rtf+=lines.map(rtfEscape).join('\\line ');
265264
if(!lic)
266265
rtf+='\\b0';
267266
rtf+='\\par\n';

0 commit comments

Comments
(0)