MCPcopy Create free account
hub / github.com/backnotprop/plannotator / unquoteGitPath

Function unquoteGitPath

packages/shared/diff-paths.ts:6–17  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

4}
5
6export 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
19export function quoteGitPath(value: string): string {
20 if (!/[\s"\\]/.test(value)) return value;

Callers 2

parsePatchPathTokenFunction · 0.85

Calls 2

parseMethod · 0.80
replaceMethod · 0.80

Tested by

no test coverage detected