Skip to content

Commit 8579a96

Browse files
committed
Fix regexp generation for "default"
1 parent 4a7c057 commit 8579a96

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

lib/node_modules/@stdlib/_tools/licenses/header-regexp-table/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ var re = out.default;
7474

7575
```text
7676
/(?:[*!#] |)@license Apache\-2\.0
77-
(?:[*!#] |)
77+
(?:[*!#]|)
7878
(?:[*!#] |)Copyright \(c\) [0-9]{1,4} .+\.
79-
(?:[*!#] |)
79+
(?:[*!#]|)
8080
(?:[*!#] |)Licensed under the Apache License, Version 2\.0 \(the "License"\);
8181
(?:[*!#] |)you may not use this file except in compliance with the License\.
8282
(?:[*!#] |)You may obtain a copy of the License at
83-
(?:[*!#] |)
83+
(?:[*!#]|)
8484
(?:[*!#] |) http:\/\/www\.apache\.org\/licenses\/LICENSE\-2\.0
85-
(?:[*!#] |)
85+
(?:[*!#]|)
8686
(?:[*!#] |)Unless required by applicable law or agreed to in writing, software
8787
(?:[*!#] |)distributed under the License is distributed on an "AS IS" BASIS,
8888
(?:[*!#] |)WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.

lib/node_modules/@stdlib/_tools/licenses/header-regexp-table/lib/main.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ function createTable( license, types ) {
125125

126126
// If "default", insert a regular expression capture group to account for variation in leading characters for each line:
127127
if ( v === 'default' ) {
128-
h = '(?:[*!#] |)' + replace( h, '\n', '\n(?:[*!#] |)' );
128+
h = replace( h, '\n\n', '{{TMP}}\n' );
129+
h = replace( h, '\n', '\n(?:[*!#] |)' );
130+
h = replace( h, '{{TMP}}', '\n(?:[*!#]|)' );
131+
h = '(?:[*!#] |)' + h;
129132
}
130133
// Replace placeholder values:
131134
h = replace( h, '\\{\\{YEAR\\}\\}', '[0-9]{1,4}' ); // 0-9999

0 commit comments

Comments
 (0)