Skip to content

Commit 89cc7fa

Browse files
committed
more test cases
1 parent 4d34350 commit 89cc7fa

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

injected/scripts/utils/comment-plugin.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ export function convertToLegalComments(source) {
4040
for (const comment of blockComments) {
4141
if (/copyright/i.test(comment)) {
4242
// Replace only the block comments with copyright
43-
modifiedSource = modifiedSource.replace(
44-
comment,
45-
comment.replace(/\/\*/, '/*!')
46-
);
43+
modifiedSource = modifiedSource.replace(comment, comment.replace(/\/\*/, '/*!'));
4744
}
4845
}
4946

@@ -64,12 +61,12 @@ export function convertToLegalComments(source) {
6461
else if (!inCommentBlock && /^\s*\/\/(?=.*copyright.*$)/i.test(line)) {
6562
// Start of a copyright comment - mark it and convert
6663
inCommentBlock = true;
67-
result.push(line.replace(/^\s*\/\//, match => match.replace('//', '//!')));
64+
result.push(line.replace(/^\s*\/\//, (match) => match.replace('//', '//!')));
6865
}
6966
// Check if we're continuing a line comment block
7067
else if (inCommentBlock && /^\s*\/\//.test(line)) {
7168
// Continue the comment block - convert the prefix
72-
result.push(line.replace(/^\s*\/\//, match => match.replace('//', '//!')));
69+
result.push(line.replace(/^\s*\/\//, (match) => match.replace('//', '//!')));
7370
}
7471
// Check if we're exiting a comment block
7572
else {

injected/unit-test/comment-plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,4 @@ const foo = 'bar';`;
196196

197197
expect(convertToLegalComments(input)).toEqual(expected);
198198
});
199-
});
199+
});

0 commit comments

Comments
 (0)