( sample: readonly HealthCheckResponseSample[], )
| 456 | * order. Every surface that renders a probe response uses this, so the |
| 457 | * interesting fields always lead. Stable within tiers. */ |
| 458 | export const rankResponseSample = ( |
| 459 | sample: readonly HealthCheckResponseSample[], |
| 460 | ): HealthCheckResponseSample[] => |
| 461 | sample |
| 462 | .map((row, index) => ({ row, index, tier: identityPathTier(row.path) })) |
| 463 | .sort((a, b) => { |
| 464 | if (a.tier !== b.tier) { |
| 465 | if (a.tier === -1) return 1; |
| 466 | if (b.tier === -1) return -1; |
| 467 | return a.tier - b.tier; |
| 468 | } |
| 469 | return a.index - b.index; |
| 470 | }) |
| 471 | .map(({ row }) => row); |
no test coverage detected