auto: 2026-09-20 02:30 (ESD_LAPTOP)
This commit is contained in:
@@ -33,6 +33,16 @@ export function withCell(row: Row, path: string, value: unknown): Row {
|
||||
return { ...row, [head]: { ...(row[head] as Row), [sub]: value } };
|
||||
}
|
||||
|
||||
/** 줄 안 깊은 자리 읽기 · 넣은 새 줄(중간 묶음 없으면 만듦). */
|
||||
export const deep = (row: Row, path: string[]): unknown =>
|
||||
path.reduce<unknown>((o, k) => (o as Row | null | undefined)?.[k], row);
|
||||
|
||||
export function withDeep(row: Row, path: string[], value: unknown): Row {
|
||||
const [head, ...rest] = path;
|
||||
if (!rest.length) return { ...row, [head]: value };
|
||||
return { ...row, [head]: withDeep((row[head] ?? {}) as Row, rest, value) };
|
||||
}
|
||||
|
||||
export function show(v: unknown): string {
|
||||
if (v === null || v === undefined) return "";
|
||||
if (Array.isArray(v)) return v.map((x) => (x === null ? "" : String(x))).join(" ~ ");
|
||||
|
||||
Reference in New Issue
Block a user