Skip to content

Commit

Permalink
chore: audit fix & format
Browse files Browse the repository at this point in the history
  • Loading branch information
btea committed Apr 4, 2024
1 parent 4f385be commit e068e55
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 38 deletions.
50 changes: 25 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Chunk.js
Expand Up @@ -115,7 +115,7 @@ export default class Chunk {
// ' test'.trim()
// split -> ' ' + 'test'
// ✔️ edit -> '' + 'test'
// ✖️ edit -> 'test' + ''
// ✖️ edit -> 'test' + ''
// TODO is this block necessary?...
newChunk.edit('', false);
this.content = '';
Expand Down
15 changes: 3 additions & 12 deletions src/MagicString.js
Expand Up @@ -800,11 +800,7 @@ export default class MagicString {
if (match.index != null) {
const replacement = getReplacement(match, this.original);
if (replacement !== match[0]) {
this.overwrite(
match.index,
match.index + match[0].length,
replacement
);
this.overwrite(match.index, match.index + match[0].length, replacement);
}
}
});
Expand All @@ -813,11 +809,7 @@ export default class MagicString {
if (match && match.index != null) {
const replacement = getReplacement(match, this.original);
if (replacement !== match[0]) {
this.overwrite(
match.index,
match.index + match[0].length,
replacement
);
this.overwrite(match.index, match.index + match[0].length, replacement);
}
}
}
Expand Down Expand Up @@ -852,8 +844,7 @@ export default class MagicString {
index = original.indexOf(string, index + stringLength)
) {
const previous = original.slice(index, index + stringLength);
if (previous !== replacement)
this.overwrite(index, index + stringLength, replacement);
if (previous !== replacement) this.overwrite(index, index + stringLength, replacement);
}

return this;
Expand Down

0 comments on commit e068e55

Please sign in to comment.