feat: 代码生成

This commit is contained in:
dap
2024-09-24 10:18:07 +08:00
parent 054fbf72cd
commit c3524ab79c
11 changed files with 644 additions and 5 deletions

View File

@@ -0,0 +1,10 @@
/**
* 跟后台逻辑一致
* Number.isSafeInteger形参只能为Number类型 其他的直接返回false
* @param str 数字
* @returns 安全数内返回number类型 否则返回原字符串
*/
export function safeParseNumber(str: string): number | string {
const num = Number(str);
return Number.isSafeInteger(num) ? num : str;
}