From 2521c8a2b2ea54757ff50d8c641b5c36cb805a53 Mon Sep 17 00:00:00 2001 From: Ayoub-Mabrouk Date: Wed, 6 Nov 2024 02:26:03 +0100 Subject: [PATCH] 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. --- scripts/version-history.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/scripts/version-history.js b/scripts/version-history.js index b8a2b0e..acf4447 100644 --- a/scripts/version-history.js +++ b/scripts/version-history.js @@ -30,7 +30,7 @@ if (historyFileLines[0].indexOf('x') !== -1) { } historyFileLines[0] = VERSION + ' / ' + getLocaleDate() -historyFileLines[1] = repeat('=', historyFileLines[0].length) +historyFileLines[1] = '='.repeat(historyFileLines[0].length) fs.writeFileSync(HISTORY_FILE_PATH, historyFileLines.join('\n')) @@ -42,16 +42,6 @@ function getLocaleDate () { zeroPad(now.getDate(), 2) } -function repeat (str, length) { - var out = '' - - for (var i = 0; i < length; i++) { - out += str - } - - return out -} - function zeroPad (number, length) { var num = number.toString()