(path, findString, replaceString)
| 10 | } |
| 11 | |
| 12 | function replaceFile(path, findString, replaceString) { |
| 13 | if (fs.existsSync(path)) { |
| 14 | let newFile; |
| 15 | let file = fs.readFileSync(path, 'utf-8'); |
| 16 | let find = new RegExp(findString); |
| 17 | let match = new RegExp(replaceString); |
| 18 | if (!match.test(file)) { |
| 19 | newFile = file.replace(find, replaceString); |
| 20 | fs.writeFileSync(path, newFile, 'utf-8'); |
| 21 | } |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | module.exports = { |
| 26 | touch, |
no outgoing calls
no test coverage detected
searching dependent graphs…