Spaces:
Paused
Paused
Download src/daemon/runtime-parse.ts from amos-fernandes/melbot: direct link, hf CLI and curl.
- Browser
- Download file 511 Bytes
-
https://huggingface.co/spaces/amos-fernandes/melbot/resolve/main/src/daemon/runtime-parse.ts
- Command line
-
hf download hf://spaces/amos-fernandes/melbot/src/daemon/runtime-parse.ts
-
curl -L -o runtime-parse.ts https://huggingface.co/spaces/amos-fernandes/melbot/resolve/main/src/daemon/runtime-parse.ts
511 Bytes
| export function parseKeyValueOutput(output: string, separator: string): Record<string, string> { | |
| const entries: Record<string, string> = {}; | |
| for (const rawLine of output.split(/\r?\n/)) { | |
| const line = rawLine.trim(); | |
| if (!line) continue; | |
| const idx = line.indexOf(separator); | |
| if (idx <= 0) continue; | |
| const key = line.slice(0, idx).trim().toLowerCase(); | |
| if (!key) continue; | |
| const value = line.slice(idx + separator.length).trim(); | |
| entries[key] = value; | |
| } | |
| return entries; | |
| } | |