ManimCat / src /utils /timings.ts
littlebrian's picture
Sync from enhance: d795216 feat: implement patch response parser for search and replace functionality
9bd4242
Raw
History Blame Contribute Delete
435 Bytes
import type { JobTimings } from '../types'
export function normalizeTimings(timings: Record<string, number>): JobTimings | undefined {
const entries = Object.entries(timings)
.filter(([, value]) => typeof value === 'number' && Number.isFinite(value) && value >= 0)
.map(([key, value]) => [key, Math.round(value)])
if (entries.length === 0) {
return undefined
}
return Object.fromEntries(entries) as JobTimings
}