Skip to content

Commit

Permalink
Merge pull request #12 from Dwarfess/patch-1
Browse files Browse the repository at this point in the history
lgtm
  • Loading branch information
ALMaclaine authored Jan 1, 2020
2 parents e4778d7 + 4045141 commit 091c671
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var fs = require("fs"),
sharedOptions = require("./bin/shared-options");

module.exports = function(options) {
var matched = [];
// If the path is the same as the default and the recursive option was not
// specified, search recursively under the current directory as a
// convenience.
Expand Down Expand Up @@ -81,6 +82,7 @@ module.exports = function(options) {
}
}

return matched;

function canSearch(file, isFile) {
var inIncludes = includes && includes.some(function(include) {
Expand Down Expand Up @@ -151,6 +153,11 @@ module.exports = function(options) {
if (canReplace && text !== null) {
fs.writeFileSync(file, text);
}

matched.push({
file,
text
});
}
else if (stats.isDirectory() && options.recursive) {
var files = fs.readdirSync(file);
Expand Down

0 comments on commit 091c671

Please sign in to comment.