MCPcopy Create free account
hub / github.com/chhoumann/quickadd / decodeFileValue

Function decodeFileValue

src/utils/fileSyntax.ts:244–251  ·  view source on GitHub ↗
(stored: unknown)

Source from the content-addressed store, hash-verified

242
243/** Decode a stored FILE variable value into its representation kind. */
244export function decodeFileValue(stored: unknown): DecodedFileValue {
245 if (typeof stored !== "string" || stored === "") return { kind: "empty" };
246 if (stored.startsWith(FILE_CUSTOM_PREFIX))
247 return { kind: "custom", text: stored.slice(FILE_CUSTOM_PREFIX.length) };
248 if (stored.startsWith(FILE_PICK_PREFIX))
249 return { kind: "file", path: stored.slice(FILE_PICK_PREFIX.length) };
250 return { kind: "raw", value: stored };
251}
252
253/** Basename of a vault path (drop folders + a trailing known extension). */
254export function fileBasenameFromPath(value: string): string {

Callers 3

fileSyntax.test.tsFile · 0.90
renderSingleFileValueFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected