(char)
| 18 | * @returns {string} escaped character |
| 19 | */ |
| 20 | const quoteMetaInCharClass = (char) => { |
| 21 | // In character class, only these need escaping: ] \ ^ - |
| 22 | if (char === "]" || char === "\\" || char === "^" || char === "-") { |
| 23 | return `\\${char}`; |
| 24 | } |
| 25 | return char; |
| 26 | }; |
| 27 | |
| 28 | /** |
| 29 | * Converts an array of single characters into an optimized character class string |
no outgoing calls
no test coverage detected