From 026de5987b1cba722bb13d36bee31ab73c6a7464 Mon Sep 17 00:00:00 2001 From: CentreMetre Date: Sun, 14 Jun 2026 17:00:35 +0100 Subject: [PATCH] Add explanation comment --- abstract-table.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/abstract-table.ts b/abstract-table.ts index cbe7dc3..962125d 100644 --- a/abstract-table.ts +++ b/abstract-table.ts @@ -47,14 +47,15 @@ export abstract class Table { exampleObject: TRow, // Needed for runtime, since types don't exist in JS. displayNamesAndOrder?: Record ): Header[] { + // Checks if display names and order was passed. If not, derives the keys to use for the header from the example object. const keys = displayNamesAndOrder ? (Object.keys(displayNamesAndOrder) as (keyof TRow)[]) : (Object.keys(exampleObject) as (keyof TRow)[]); return keys.map(key => ({ - key, - value: displayNamesAndOrder?.[key] ?? String(key), - type: typeof exampleObject[key], + key, // Raw property name from TRow + value: displayNamesAndOrder?.[key] ?? String(key), // The value of the th html element, with a nullish coalescing operator for if its null + type: typeof exampleObject[key], // The type of the column })); }