Skip to content

Commit a1fe4c7

Browse files
authored
Update util.js (#3)
* Update util.js Two small changes to 'entries': - regexp search for whitespace, instead of search for ' ', to support tabs - added a conditional for '@unwrap' and '@noframes' so that these will be seen as valid entries * Update util.js Made suggested changes: #3 (review)
1 parent d5478ce commit a1fe4c7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/util.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ export function getMetadata(metaFileContent, additionalGrantList) {
5555
.map(line => {
5656
if (!line.startsWith('// ')) return;
5757
line = line.slice(3).trim();
58-
const i = line.indexOf(' ');
59-
if (i < 0) return;
60-
const key = line.slice(0, i);
61-
const value = line.slice(i + 1).trim();
58+
const matches = line.match(/^(\S+)(\s.*)?$/);
59+
if (!matches) return;
60+
const key = matches[1];
61+
const value = (matches[2] || '').trim();
6262
if (key === '@grant') {
6363
grantSet.add(value);
6464
return;

0 commit comments

Comments
 (0)