MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / makeSort

Function makeSort

web/src/js/ducks/flows/index.ts:319–343  ·  view source on GitHub ↗
({
    column,
    desc,
}: {
    column?: keyof typeof sortFunctions;
    desc: boolean;
})

Source from the content-addressed store, hash-verified

317}
318
319export function makeSort({
320 column,
321 desc,
322}: {
323 column?: keyof typeof sortFunctions;
324 desc: boolean;
325}): Comparer<Flow> {
326 if (!column) {
327 return (_a, _b) => 0;
328 }
329 const sortKeyFun = sortFunctions[column];
330 return (a, b) => {
331 const ka = sortKeyFun(a);
332 const kb = sortKeyFun(b);
333 // @ts-expect-error undefined is fine
334 if (ka > kb) {
335 return desc ? -1 : 1;
336 }
337 // @ts-expect-error undefined is fine
338 if (ka < kb) {
339 return desc ? 1 : -1;
340 }
341 return 0;
342 };
343}
344
345export function selectRelative(flows: FlowsState, shift: number) {
346 const lastSelected: Flow | undefined =

Callers 1

flowsReducerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…