From 8ac3a8cba97da074afd72c8518c4001075239919 Mon Sep 17 00:00:00 2001 From: Dwarfess Date: Wed, 8 Jan 2020 18:47:29 +0200 Subject: [PATCH] Update replace.js Please accept these changes. During previous changes I didn't consider than the 'text field' already contains path of the file and also we need to check if text exists --- replace.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/replace.js b/replace.js index 17e37d5..429d1a6 100644 --- a/replace.js +++ b/replace.js @@ -152,12 +152,9 @@ module.exports = function(options) { text = replacizeText(text, file); if (canReplace && text !== null) { fs.writeFileSync(file, text); + } else if (text) { + matched.push(text); } - - matched.push({ - file, - text - }); } else if (stats.isDirectory() && options.recursive) { var files = fs.readdirSync(file);