Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
25 lines
651 B
Plaintext
25 lines
651 B
Plaintext
// src/common/text.ts
|
|
var safeText = (text) => {
|
|
if ((text == null ? void 0 : text.length) <= 4) return text;
|
|
return text == null ? void 0 : text.slice(0, 3);
|
|
};
|
|
var safeInitials = (text) => {
|
|
const initials = (text == null ? void 0 : text.trim().split(/[\s\-_.]+/).filter(Boolean).map((word) => word.charAt(0).toUpperCase()).join("")) || "";
|
|
return safeText(initials);
|
|
};
|
|
var safeAriaLabel = (...texts) => {
|
|
let ariaLabel = " ";
|
|
for (const text of texts) {
|
|
if (typeof text === "string" && text.length > 0) {
|
|
ariaLabel = text;
|
|
break;
|
|
}
|
|
}
|
|
return ariaLabel;
|
|
};
|
|
export {
|
|
safeAriaLabel,
|
|
safeInitials,
|
|
safeText
|
|
};
|