Skip to content

Commit

Permalink
fix: only replace code if present
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Apr 7, 2019
1 parent 59bdd40 commit b1b41a8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ function run(arr, str) {
let i=0, tmp={};
for (; i < arr.length;) {
tmp = Reflect.get(CODES, arr[i++]);
if (str.includes(tmp.close)) {
str = tmp.open + str.replace(tmp.rgx, tmp.open) + tmp.close;
}
}
return str;
}

Expand Down

0 comments on commit b1b41a8

Please sign in to comment.