( sample: readonly HealthCheckResponseSample[], )
| 660 | * order. Every surface that renders a probe response uses this, so the |
| 661 | * interesting fields always lead. Stable within tiers. */ |
| 662 | export const rankResponseSample = ( |
| 663 | sample: readonly HealthCheckResponseSample[], |
| 664 | ): HealthCheckResponseSample[] => |
| 665 | sample |
| 666 | .map((row, index) => ({ row, index, tier: identityPathTier(row.path) })) |
| 667 | .sort((a, b) => { |
| 668 | if (a.tier !== b.tier) { |
| 669 | if (a.tier === -1) return 1; |
| 670 | if (b.tier === -1) return -1; |
| 671 | return a.tier - b.tier; |
| 672 | } |
| 673 | return a.index - b.index; |
| 674 | }) |
| 675 | .map(({ row }) => row); |
no test coverage detected