Download src/lib/coding/serialize.ts from NAP1320/RotNot: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/spaces/NAP1320/RotNot/resolve/main/src/lib/coding/serialize.ts
- Command line
-
hf download hf://spaces/NAP1320/RotNot/src/lib/coding/serialize.ts
-
curl -L -o serialize.ts https://huggingface.co/spaces/NAP1320/RotNot/resolve/main/src/lib/coding/serialize.ts
1.29 kB
| import type { CodingProblem, PublicCodingProblem } from "./types"; | |
| // --------------------------------------------------------------------------- | |
| // Strip answer keys before a problem crosses the wire to the browser. | |
| // | |
| // The reference solution, the full hidden-test set, the known review issues, | |
| // and the architecture rubric all stay server-side. The client only ever sees | |
| // what a real candidate would see: the prompt, starter/buggy code, and the | |
| // public (non-hidden) example tests. | |
| // --------------------------------------------------------------------------- | |
| export function toPublicProblem(problem: CodingProblem): PublicCodingProblem { | |
| switch (problem.type) { | |
| case "code-creation": { | |
| const { referenceSolution: _ref, tests, ...rest } = problem; | |
| void _ref; | |
| return { ...rest, tests: tests.filter((t) => !t.hidden) }; | |
| } | |
| case "debugging": { | |
| const { referenceSolution: _ref, tests, ...rest } = problem; | |
| void _ref; | |
| return { ...rest, tests: tests.filter((t) => !t.hidden) }; | |
| } | |
| case "code-review": { | |
| const { issues: _issues, ...rest } = problem; | |
| void _issues; | |
| return rest; | |
| } | |
| case "architecture": { | |
| const { rubric: _rubric, ...rest } = problem; | |
| void _rubric; | |
| return rest; | |
| } | |
| } | |
| } | |