mirror of
https://github.com/certd/certd.git
synced 2026-04-18 16:40:54 +08:00
18 lines
353 B
TypeScript
18 lines
353 B
TypeScript
import dayjs from "dayjs";
|
|
|
|
export const stringUtils = {
|
|
maxLength(str?: string, length = 100) {
|
|
if (str) {
|
|
return str.length > length ? str.slice(0, length) + "..." : str;
|
|
}
|
|
return "";
|
|
},
|
|
|
|
appendTimeSuffix(str?: string) {
|
|
if (str) {
|
|
return `${str}-${dayjs().format("YYYYMMDDHHmmssSSS")}`;
|
|
}
|
|
return "";
|
|
},
|
|
};
|