First upload version 0.0.1

This commit is contained in:
Neyra
2026-02-05 15:27:49 +08:00
commit 8e9b7201ed
4182 changed files with 593136 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
export const TRUNCATE_TEXT_MAX_LENGTH = 30;
export function truncateText(text, maxLength = TRUNCATE_TEXT_MAX_LENGTH) {
if (text.length <= maxLength) {
return text;
}
const ellipsis = "...";
const charsToShow = maxLength - ellipsis.length;
const firstPartChars = Math.ceil(charsToShow / 2);
const secondPartChars = Math.floor(charsToShow / 2);
return text.substring(0, firstPartChars) + ellipsis + text.substring(text.length - secondPartChars);
}
export function centerPad(text, length) {
const padLength = Math.max(0, length - text.length);
const leftPad = Math.floor(padLength / 2);
const rightPad = Math.ceil(padLength / 2);
return " ".repeat(leftPad) + text + " ".repeat(rightPad);
}
//# sourceMappingURL=cli-text.js.map