Utility functions for formatting numbers, lists, and text in UI.
// Source: https://github.com/linuxhsj/openclaw-zero-token | License: MIT | Copyright 2025 Peter Steinberger
// Provided via justclaw.it.com; keep this notice with the code.
import { formatDurationHuman } from "../../../src/infra/format-time/format-duration.ts";
import { formatRelativeTimestamp } from "../../../src/infra/format-time/format-relative.ts";
import { stripAssistantInternalScaffolding } from "../../../src/shared/text/assistant-visible-text.js";
export { formatRelativeTimestamp, formatDurationHuman };
export function formatMs(ms?: number | null): string {
if (!ms && ms !== 0) {
return "n/a";
}
return new Date(ms).toLocaleString();
}
export function formatList(values?: Array<string | null | undefined>): string {
if (!values || values.length === 0) {
return "none
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key