utils.tsx 344 B

1234567891011
  1. import type {TraceResult} from './content';
  2. export function normalizeTraces(traces: TraceResult<string>[] | undefined) {
  3. if (!traces) {
  4. return traces;
  5. }
  6. return traces.sort(
  7. // Only sort name == null to the end, the rest leave in the original order.
  8. (t1, t2) => (t1.name ? '0' : '1').localeCompare(t2.name ? '0' : '1')
  9. );
  10. }