emptyDisplay.ts 379 Bytes
/** Backend empty placeholder (US API may return this literal). */
export const BACKEND_EMPTY_DISPLAY = "无";

/** Map API empty sentinels to English UI text. */
export function formatDisplayText(
  value: string | null | undefined,
  fallback = "None",
): string {
  const s = String(value ?? "").trim();
  if (!s || s === BACKEND_EMPTY_DISPLAY) return fallback;
  return s;
}