Skip to content

Commit 3592267

Browse files
committed
Use string.replaceAll() shim rather than regex
Resolves #19
1 parent 02025dc commit 3592267

File tree

3 files changed

+135
-1
lines changed

3 files changed

+135
-1
lines changed

package-lock.json

Lines changed: 131 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"dependencies": {
2020
"@octokit/rest": "^18.0.0",
2121
"prompt-confirm": "^2.0.4",
22+
"string.prototype.replaceall": "^1.0.3",
2223
"yargs": "^15.3.1"
2324
},
2425
"bin": {

src/update-content.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const replaceAll = require("string.prototype.replaceall");
2+
13
module.exports = async function (
24
owner,
35
repo,
@@ -27,7 +29,7 @@ module.exports = async function (
2729
let content = file.content;
2830
for (let r of replacements[path]) {
2931
var re = new RegExp(r.from, "g");
30-
content = content.replace(re, r.to);
32+
content = replaceAll(content, r.from, r.to);
3133
}
3234

3335
if (content !== file.content) {

0 commit comments

Comments
 (0)