Fixed invalid definition for updatedContent in addWordToFile()

This commit is contained in:
Paul Black 2023-09-15 17:21:29 -06:00
parent 01f2b8d08b
commit 3c54d422a3

View file

@ -120,13 +120,15 @@ function addWordToFile(filePath, dataArray, word) {
return;
}
let updatedContent;
if (!data.trim()) {
console.log(filePath + ' is blank, not adding new line.');
updatedContent = word;
}
else {
// Append new line and word
const updatedContent = `${data.trimRight()}\n${word}`;
updatedContent = `${data.trimRight()}\n${word}`;
}
// Write the new content to file