MCPcopy Create free account
hub / github.com/ShipSecAI/studio / applyOrder

Function applyOrder

frontend/src/pages/WorkflowList.tsx:66–74  ·  view source on GitHub ↗
(items: T[], savedOrder: string[])

Source from the content-addressed store, hash-verified

64}
65
66function applyOrder<T extends { id: string }>(items: T[], savedOrder: string[]): T[] {
67 if (savedOrder.length === 0) return items;
68 const orderMap = new Map(savedOrder.map((id, idx) => [id, idx]));
69 return [...items].sort((a, b) => {
70 const aIdx = orderMap.get(a.id) ?? Infinity;
71 const bIdx = orderMap.get(b.id) ?? Infinity;
72 return aIdx - bIdx;
73 });
74}
75
76export function WorkflowList() {
77 const navigate = useNavigate();

Callers 1

WorkflowListFunction · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected