MCPcopy Index your code
hub / github.com/anomalyco/opencode / stripQueryAndHash

Function stripQueryAndHash

packages/app/src/context/file/path.ts:6–17  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

4}
5
6export function stripQueryAndHash(input: string) {
7 const hashIndex = input.indexOf("#")
8 const queryIndex = input.indexOf("?")
9
10 if (hashIndex !== -1 && queryIndex !== -1) {
11 return input.slice(0, Math.min(hashIndex, queryIndex))
12 }
13
14 if (hashIndex !== -1) return input.slice(0, hashIndex)
15 if (queryIndex !== -1) return input.slice(0, queryIndex)
16 return input
17}
18
19export function unquoteGitPath(input: string) {
20 if (!input.startsWith('"')) return input

Callers 2

path.test.tsFile · 0.90
normalizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected