feat: 初始化

This commit is contained in:
George
2025-07-07 16:05:18 +08:00
commit c169958240
986 changed files with 132574 additions and 0 deletions

View File

@ -0,0 +1,24 @@
// @ts-nocheck
// export function toLowercaseSeparator(key: string) {
// return key.replace(/([A-Z])/g, '-$1').toLowerCase();
// }
/**
* 将字符串转换为指定连接符的命名约定
* @param str 要转换的字符串
* @param separator 指定的连接符,默认为 "-"
* @returns 转换后的字符串
*/
export function kebabCase(str : string, separator : string = "-") : string {
return str
// #ifdef APP-IOS || APP-ANDROID
.replace(/[A-Z]/g, (match : string, _ : number, _ : string) : string => `${separator}${match.toLowerCase()}`) // 将大写字母替换为连接符加小写字母
// #endif
// #ifndef APP-IOS || APP-ANDROID
.replace(/[A-Z]/g, (match : string) : string => `${separator}${match.toLowerCase()}`) // 将大写字母替换为连接符加小写字母
// #endif
.replace(/[\s_-]+/g, separator) // 将空格、下划线和短横线替换为指定连接符
.replace(new RegExp(`^${separator}|${separator}$`, "g"), "") // 删除开头和结尾的连接符
.toLowerCase(); // 将结果转换为全小写
}