feat: format subtitle

This commit is contained in:
Gabe
2025-10-09 02:15:58 +08:00
parent 40b3072e5f
commit 71b2d62c9f
7 changed files with 299 additions and 67 deletions

View File

@@ -362,3 +362,15 @@ export const truncateWords = (str, maxLength) => {
const truncated = str.slice(0, maxLength);
return truncated.slice(0, truncated.lastIndexOf(" ")) + " …";
};
/**
* 生成随机数
* @param {*} min
* @param {*} max
* @param {*} integer
* @returns
*/
export const randomBetween = (min, max, integer = true) => {
const value = Math.random() * (max - min) + min;
return integer ? Math.floor(value) : value;
};