UNPKG

2.05 kBPlain TextView Raw
1diff --git a/replace.js b/replace.js
2index 6e45164..a6884de 100644
3--- a/replace.js
4+++ b/replace.js
5@@ -2,6 +2,7 @@ var fs = require("fs"),
6 path = require("path"),
7 colors = require("colors");
8
9+
10 var excludes = [],
11 includes,
12 regex,
13@@ -35,7 +36,7 @@ module.exports = function(opts) {
14 return line && line.indexOf("#");
15 })
16 .map(patternToRegex);
17-
18+
19 if (!options.silent) {
20 var verb = canReplace ? "Replaced" : "Found";
21 console.log(verb + " occurences in these files:");
22@@ -64,7 +65,7 @@ function includeFile(file) {
23 if (file.match(includes[i]))
24 return true;
25 }
26- return false;
27+ return false;
28 }
29 else {
30 for (var i = 0; i < excludes.length; i++) {
31@@ -86,7 +87,7 @@ function replacizeFile(file) {
32 if (stats.isFile()) {
33 if (!includeFile(file)) {
34 return;
35- }
36+ }
37 fs.readFile(file, "utf-8", function(err, text) {
38 if (err) {
39 if (err.code == 'EMFILE') {
40@@ -96,7 +97,7 @@ function replacizeFile(file) {
41 throw err;
42 }
43
44- text = replacizeText(text, file);
45+ text = replacizeText(text, file);
46 if(canReplace) {
47 fs.writeFile(file, text, function(err) {
48 if (err) throw err;
49@@ -124,7 +125,7 @@ function replacizeFileSync(file) {
50 if (stats.isFile()) {
51 if (!includeFile(file)) {
52 return;
53- }
54+ }
55 var text = fs.readFileSync(file, "utf-8");
56
57 text = replacizeText(text, file);
58@@ -135,7 +136,7 @@ function replacizeFileSync(file) {
59 else if (stats.isDirectory() && options.recursive) {
60 var files = fs.readdirSync(file);
61 for (var i = 0; i < files.length; i++) {
62- replacizeFileSync(path.join(file, files[i]));
63+ replacizeFileSync(path.join(file, files[i]));
64 }
65 }
66 }