Skip to content

Commit f897998

Browse files
committed
Use function vars instead of RegExp globals
1 parent 1251e56 commit f897998

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

env-filter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ process.stdin.on("end", function(){
66
process.stdout.write(
77
text
88
.replace(/\{\{bust\}\}/g, bust)
9-
.replace(/(?:<!--\s+)?\{\{(dev|build)\}\}((?:.|\n)+?)?\{\{\/\1\}\}(?:\s+-->)?/g, function(){
9+
.replace(/(?:<!--\s+)?\{\{(dev|build)\}\}((?:.|\n)+?)?\{\{\/\1\}\}(?:\s+-->)?/g, function(_, env, content){
1010
// Enable the contents of the 'build' sections and remove the 'dev' sections.
11-
return RegExp.$1 == 'build' ? RegExp.$2 : '';
11+
return env === 'build' ? content : '';
1212
})
1313
// Remove any remaining blank lines.
1414
.replace(/\n{2,}/g, "\n")

0 commit comments

Comments
 (0)