(text: string)
| 47 | } |
| 48 | |
| 49 | export function cleanLine(text: string): string { |
| 50 | let cleaned = ''; |
| 51 | let withinQuotes = null; |
| 52 | for (let i = 0; i < text.length; i++) { |
| 53 | const c = text[i]; |
| 54 | if (isQuote(c)) { |
| 55 | if (withinQuotes === null) { |
| 56 | withinQuotes = c; |
| 57 | } else if (withinQuotes === c) { |
| 58 | withinQuotes = null; |
| 59 | } |
| 60 | } |
| 61 | if (isComment(c) && !withinQuotes) { |
| 62 | break; |
| 63 | } |
| 64 | |
| 65 | cleaned += c; |
| 66 | } |
| 67 | return (cleaned.trimEnd()); |
| 68 | } |
| 69 | |
| 70 | function doesLineEndInOperator(text: string) { |
| 71 | const endingOperatorIndex = text.search(/(\(|,|\+|!|\$|\^|&|\*|-|=|:|~|\||\/|\?|<|>|%.*%)(\s*|\s*#.*)$/); |
no test coverage detected