Download superlog/apps/web/src/incident-pr-diff-model.ts from smlflg/Experimente: direct link, hf CLI and curl.
- Browser
- Download file 640 Bytes
-
https://huggingface.co/smlflg/Experimente/resolve/main/superlog/apps/web/src/incident-pr-diff-model.ts
- Command line
-
hf download hf://smlflg/Experimente/superlog/apps/web/src/incident-pr-diff-model.ts
-
curl -L -o incident-pr-diff-model.ts https://huggingface.co/smlflg/Experimente/resolve/main/superlog/apps/web/src/incident-pr-diff-model.ts
640 Bytes
| import { parsePatchFiles, type FileDiffMetadata } from "@pierre/diffs"; | |
| export type IncidentPrDiffFile = FileDiffMetadata; | |
| export function parseIncidentPrPatchFiles(patch: string): IncidentPrDiffFile[] { | |
| try { | |
| return parsePatchFiles(patch, "incident-pr", true).flatMap((parsed) => parsed.files); | |
| } catch { | |
| return []; | |
| } | |
| } | |
| export function visibleIncidentPrDiffFiles( | |
| files: IncidentPrDiffFile[], | |
| selectedFileName: string | null, | |
| ): IncidentPrDiffFile[] { | |
| if (!selectedFileName) return files; | |
| const selectedFile = files.find((file) => file.name === selectedFileName); | |
| return selectedFile ? [selectedFile] : files; | |
| } | |