Skip to content

Commit f3c9923

Browse files
committed
refactor add const for optional comma
1 parent 6191e66 commit f3c9923

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tasks/compress_attributes.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@ var through = require('through2');
55
* of the plotly.js bundles
66
*/
77

8+
var OPTIONAL_COMMA = ',?';
89

910
// one line string with or without trailing comma
1011
function makeStringRegex(attr) {
1112
return makeRegex(
12-
attr + ': \'.*\'' + ',?'
13+
attr + ': \'.*\'' + OPTIONAL_COMMA
1314
);
1415
}
1516

1617
// joined array of strings with or without trailing comma
1718
function makeJoinedArrayRegex(attr) {
1819
return makeRegex(
19-
attr + ': \\[[\\s\\S]*?\\]' + '\\.join\\(.*' + ',?'
20+
attr + ': \\[[\\s\\S]*?\\]' + '\\.join\\(.*' + OPTIONAL_COMMA
2021
);
2122
}
2223

2324
// array with or without trailing comma
2425
function makeArrayRegex(attr) {
2526
return makeRegex(
26-
attr + ': \\[[\\s\\S]*?\\]' + ',?'
27+
attr + ': \\[[\\s\\S]*?\\]' + OPTIONAL_COMMA
2728
);
2829
}
2930

0 commit comments

Comments
 (0)