update: play property animation

update: event format field
fix: test
This commit is contained in:
Vick Scarlet
2026-08-16 20:06:16 +08:00
committed by 神戸小鳥
parent cd82d175c2
commit 6eea7d0d87
15 changed files with 110 additions and 155 deletions
+15
View File
@@ -43,3 +43,18 @@ export function keys<T extends object, K extends keyof T = never>(
const filterSet = new Set<keyof T>(filter)
return allKeys.filter(key => !filterSet.has(key)) as Exclude<keyof T, K>[]
}
// 定义获取字段值的方法签名
export type GetValueFn = (
fieldName: string,
) => string | number | boolean | null | undefined
export function format(str: string, getValueFn: GetValueFn): string {
if (!str) return ''
return str.replace(
/\{([^}]+)\}/g,
(match: string, fieldName: string): string => {
const value = getValueFn(fieldName)
if (value === undefined || value === null) return match
return String(value)
},
)
}