🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
/** Returns a copy of `items` with the element at `from` moved to `to`. */
export function moveItem<T>(items: T[], from: number, to: number): T[] {
if (
from === to ||
from < 0 ||
to < 0 ||
from >= items.length ||
to >= items.length
) {
return items;
}
const next = [...items];
const [item] = next.splice(from, 1);
next.splice(to, 0, item!);
return next;
}