File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -40,10 +40,7 @@ export function convertToLegalComments(source) {
40
40
for ( const comment of blockComments ) {
41
41
if ( / c o p y r i g h t / i. test ( comment ) ) {
42
42
// Replace only the block comments with copyright
43
- modifiedSource = modifiedSource . replace (
44
- comment ,
45
- comment . replace ( / \/ \* / , '/*!' )
46
- ) ;
43
+ modifiedSource = modifiedSource . replace ( comment , comment . replace ( / \/ \* / , '/*!' ) ) ;
47
44
}
48
45
}
49
46
@@ -64,12 +61,12 @@ export function convertToLegalComments(source) {
64
61
else if ( ! inCommentBlock && / ^ \s * \/ \/ (? = .* c o p y r i g h t .* $ ) / i. test ( line ) ) {
65
62
// Start of a copyright comment - mark it and convert
66
63
inCommentBlock = true ;
67
- result . push ( line . replace ( / ^ \s * \/ \/ / , match => match . replace ( '//' , '//!' ) ) ) ;
64
+ result . push ( line . replace ( / ^ \s * \/ \/ / , ( match ) => match . replace ( '//' , '//!' ) ) ) ;
68
65
}
69
66
// Check if we're continuing a line comment block
70
67
else if ( inCommentBlock && / ^ \s * \/ \/ / . test ( line ) ) {
71
68
// 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 ( '//' , '//!' ) ) ) ;
73
70
}
74
71
// Check if we're exiting a comment block
75
72
else {
Original file line number Diff line number Diff line change @@ -196,4 +196,4 @@ const foo = 'bar';`;
196
196
197
197
expect ( convertToLegalComments ( input ) ) . toEqual ( expected ) ;
198
198
} ) ;
199
- } ) ;
199
+ } ) ;
You can’t perform that action at this time.
0 commit comments