(value: string)
| 4 | } |
| 5 | |
| 6 | export function unquoteGitPath(value: string): string { |
| 7 | if (!value.startsWith('"') || !value.endsWith('"')) return value; |
| 8 | try { |
| 9 | return JSON.parse(value) as string; |
| 10 | } catch { |
| 11 | return value.slice(1, -1) |
| 12 | .replace(/\\"/g, '"') |
| 13 | .replace(/\\\\/g, "\\") |
| 14 | .replace(/\\t/g, "\t") |
| 15 | .replace(/\\n/g, "\n"); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | export function quoteGitPath(value: string): string { |
| 20 | if (!/[\s"\\]/.test(value)) return value; |
no test coverage detected