MCPcopy Index your code
hub / github.com/simstudioai/sim / compareSortValues

Function compareSortValues

apps/sim/lib/logs/list-logs.ts:405–417  ·  view source on GitHub ↗
(a: unknown, b: unknown)

Source from the content-addressed store, hash-verified

403 })
404
405 const compareSortValues = (a: unknown, b: unknown): number => {
406 if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime()
407 if (typeof a === 'number' && typeof b === 'number') return a - b
408 const aStr = String(a)
409 const bStr = String(b)
410 if (sortBy === 'date') {
411 return new Date(aStr).getTime() - new Date(bStr).getTime()
412 }
413 const aNum = Number(aStr)
414 const bNum = Number(bStr)
415 if (!Number.isNaN(aNum) && !Number.isNaN(bNum)) return aNum - bNum
416 return aStr.localeCompare(bStr)
417 }
418
419 const merged = [...workflowMapped, ...jobMapped].sort((a, b) => {
420 const aNull = a.sortValue === null || a.sortValue === undefined

Callers 1

listLogsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected