feat(project): init

This commit is contained in:
2026-02-03 18:05:47 +08:00
commit f37a119eff
188 changed files with 29246 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
export const appendCapped = <T>(
prev: T[],
next: T[],
max: number,
onDrop?: (item: T) => void
) => {
const merged = [...prev, ...next]
if (merged.length <= max) return merged
const dropCount = merged.length - max
if (onDrop) {
for (let i = 0; i < dropCount; i += 1) onDrop(merged[i])
}
return merged.slice(dropCount)
}