Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

519 B
Raw Blame
/**
 * `order` with `id` moved to just before or after `targetId`; undefined
 * when either is missing or they are the same.
 */
export function moveBeside(
  order: readonly string[],
  id: string,
  targetId: string,
  edge: 'before' | 'after'
): string[] | undefined {
  if (id === targetId || !order.includes(id) || !order.includes(targetId))
    return undefined;
  const moved = order.filter((entry) => entry !== id);
  moved.splice(moved.indexOf(targetId) + (edge === 'after' ? 1 : 0), 0, id);
  return moved;
}