Skip to content

Commit

Permalink
fix: serialize regexpes properly in the server-side config
Browse files Browse the repository at this point in the history
Fixes #307
  • Loading branch information
rchl committed Apr 20, 2021
1 parent 9ac16b4 commit 0421488
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions lib/templates/options.ejs
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
/* eslint-disable */
<%
function stringifyValue(value) {
if (typeof value === 'string') {
return `'${value}'`
} else if (value === undefined || value === null || typeof value === 'boolean' || typeof value === 'function') {
return String(value);
} else {
return JSON.stringify(value)
}
}
for (const [key, value] of Object.entries(options)) {
%>export const <%= key %> = <%= stringifyValue(value) %>
%>export const <%= key %> = <%= serialize(value) %>
<%
}
%>

0 comments on commit 0421488

Please sign in to comment.