diff --git a/index.js b/index.js index 139cb13..729e618 100644 --- a/index.js +++ b/index.js @@ -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