Fixed invalid definition for updatedContent in addWordToFile()
This commit is contained in:
parent
01f2b8d08b
commit
3c54d422a3
1 changed files with 3 additions and 1 deletions
4
index.js
4
index.js
|
@ -120,13 +120,15 @@ function addWordToFile(filePath, dataArray, word) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let updatedContent;
|
||||||
|
|
||||||
if (!data.trim()) {
|
if (!data.trim()) {
|
||||||
console.log(filePath + ' is blank, not adding new line.');
|
console.log(filePath + ' is blank, not adding new line.');
|
||||||
updatedContent = word;
|
updatedContent = word;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Append new line and word
|
// Append new line and word
|
||||||
const updatedContent = `${data.trimRight()}\n${word}`;
|
updatedContent = `${data.trimRight()}\n${word}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the new content to file
|
// Write the new content to file
|
||||||
|
|
Loading…
Reference in a new issue