| 80 | } |
| 81 | |
| 82 | const removeComments = rawValue => { |
| 83 | const commentMatches = VARIABLE_VALUE_COMMENT_REGEX.exec(rawValue) |
| 84 | if (commentMatches == null) { |
| 85 | return rawValue |
| 86 | } |
| 87 | const [valueWithoutComment, comment] = commentMatches.slice(1) |
| 88 | // if odd number of quotes before and after comment => comment is escaped |
| 89 | if ( |
| 90 | hasOddNumberOfQuotes(valueWithoutComment) && |
| 91 | hasOddNumberOfQuotes(comment) |
| 92 | ) { |
| 93 | return `${valueWithoutComment}${comment}` |
| 94 | } |
| 95 | return valueWithoutComment |
| 96 | } |
| 97 | |
| 98 | const hasOddNumberOfQuotes = text => { |
| 99 | const numberOfQuotes = (text.match(/(?:^|[^\\])"/g) || []).length |
no test coverage detected
searching dependent graphs…