Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b8dbf74

Browse files
committed
fix regular exp to compress joined array attributes
1 parent c58fe87 commit b8dbf74

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tasks/util/compress_attributes.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ var attributeNamesToRemove = [
99
'description', 'requiredOpts', 'otherOpts', 'hrName', 'role'
1010
];
1111

12-
// ref: http://www.regexr.com/3bj6p
12+
// ref: http://www.regexr.com/3cmac
1313
var regexStr = '';
1414
attributeNamesToRemove.forEach(function(attr, i) {
1515
// one line string with or without trailing comma
1616
regexStr += attr + ': \'.*\'' + ',?' + '|';
17-
// array of strings with or without trailing comma
18-
regexStr += attr + ':.*\\n*.*\\.join\\(\\\'\\s\\\'\\)';
1917

20-
// attr:.*\n.*\.join\(\'\s\'\)
18+
// joined array of strings with or without trailing comma
19+
regexStr += attr + ': \\[[\\s\\S]*?\\]\\.join\\(.*' + ',?';
2120

2221
if(i !== attributeNamesToRemove.length-1) regexStr += '|';
2322
});

0 commit comments

Comments
 (0)