mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 23:08:28 +00:00
refactor(commands): centralize shared command formatting helpers
This commit is contained in:
7
src/commands/text-format.ts
Normal file
7
src/commands/text-format.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export const shortenText = (value: string, maxLen: number) => {
|
||||
const chars = Array.from(value);
|
||||
if (chars.length <= maxLen) {
|
||||
return value;
|
||||
}
|
||||
return `${chars.slice(0, Math.max(0, maxLen - 1)).join("")}…`;
|
||||
};
|
||||
Reference in New Issue
Block a user