mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-04 22:02:52 +00:00
Adds broad inline comments and JSDoc for CLI, cron, outbound/channel, plugin SDK, ACP, shared helpers, net policy, and related utility contracts. Proof: git diff --check on latest exact head plus focused cron tests passed; CI had no failing checks observed before merge attempt.
17 lines
650 B
TypeScript
17 lines
650 B
TypeScript
/** Formats a bounded comma-separated sample of string entries with a hidden-count suffix. */
|
|
export function summarizeStringEntries(params: {
|
|
entries?: ReadonlyArray<string> | null;
|
|
limit?: number;
|
|
emptyText?: string;
|
|
}): string {
|
|
const entries = params.entries ?? [];
|
|
if (entries.length === 0) {
|
|
return params.emptyText ?? "";
|
|
}
|
|
const rawLimit = params.limit ?? 6;
|
|
const limit = Number.isFinite(rawLimit) ? Math.max(1, Math.floor(rawLimit)) : 6;
|
|
const sample = entries.slice(0, limit);
|
|
const suffix = entries.length > sample.length ? ` (+${entries.length - sample.length})` : "";
|
|
return `${sample.join(", ")}${suffix}`;
|
|
}
|