Skip to content

Commit

Permalink
leading non-whitespace in mapping or condition
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
  • Loading branch information
mherwege committed Oct 24, 2023
1 parent 9286571 commit 323990c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function writeWidget (widget, indent) {
dsl += '['
dsl += widget.config[key].filter(Boolean).map(mapping => {
return mapping.split('=').map(value => {
if (/^[^"'].*\W.*[^"']$/.test(value)) {
if (/^.*\W.*$/.test(value) && /^[^"'].*[^"']$/.test(value)) {
return '"' + value + '"'
}
return value
Expand Down Expand Up @@ -74,7 +74,7 @@ function writeConditions (value, hasArgument = false) {
return conditions.split(' AND ').map(condition => {
let index = Math.max(condition.lastIndexOf('='), condition.lastIndexOf('>'), condition.lastIndexOf('<')) + 1
let conditionValue = condition.substring(index).trim()
if (/^[^"'].*\W.*[^"']$/.test(conditionValue)) {
if (/^.*\W.*$/.test(conditionValue) && /^[^"'].*[^"']$/.test(conditionValue)) {
conditionValue = '"' + conditionValue + '"'
}
return condition.substring(0, index) + conditionValue
Expand Down

0 comments on commit 323990c

Please sign in to comment.