feat: define simulator data contracts

This commit is contained in:
Codex
2026-08-28 09:07:58 +09:00
parent 4c5756a5a9
commit 582d0013e6
15 changed files with 2373 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
export async function readJsonFile(file) {
try {
return JSON.parse(await file.text());
} catch (error) {
const reason = error instanceof Error ? error.message : String(error);
throw new Error(`${file.name} 파일은 올바른 JSON이 아닙니다: ${reason}`);
}
}
export function downloadJson(value, fileName) {
const body = `${JSON.stringify(value, null, 2)}\n`;
const url = URL.createObjectURL(new Blob([body], { type: "application/json" }));
const anchor = document.createElement("a");
anchor.href = url;
anchor.download = fileName;
anchor.click();
setTimeout(() => URL.revokeObjectURL(url), 0);
}
export function deepClone(value) {
return structuredClone(value);
}