Skip to content

Commit 2ceda41

Browse files
Ayoub-Mabroukwesleytodd
authored andcommitted
Refactor HISTORY.md header update to use String.prototype.repeat
Replaced the custom repeat function with String.prototype.repeat to simplify the code and improve readability. This change leverages modern JavaScript functionality, reducing complexity and improving efficiency when updating the HISTORY.md header.
1 parent 96886b3 commit 2ceda41

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

scripts/version-history.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ if (historyFileLines[0].indexOf('x') !== -1) {
3030
}
3131

3232
historyFileLines[0] = VERSION + ' / ' + getLocaleDate()
33-
historyFileLines[1] = repeat('=', historyFileLines[0].length)
33+
historyFileLines[1] = '='.repeat(historyFileLines[0].length)
3434

3535
fs.writeFileSync(HISTORY_FILE_PATH, historyFileLines.join('\n'))
3636

@@ -42,16 +42,6 @@ function getLocaleDate () {
4242
zeroPad(now.getDate(), 2)
4343
}
4444

45-
function repeat (str, length) {
46-
var out = ''
47-
48-
for (var i = 0; i < length; i++) {
49-
out += str
50-
}
51-
52-
return out
53-
}
54-
5545
function zeroPad (number, length) {
5646
return number.toString().padStart(length, '0')
5747
}

0 commit comments

Comments
 (0)