Utilities

Composes cleanup functions and makes the composed cleanup idempotent.

const cleanup = combine(cleanupDraggable, cleanupTarget, cleanupMonitor);
cleanup();
cleanup(); // no-op

Runs a function once and returns the first result for later calls.

const setup = once(() => expensiveSetup());

Returns a reordered copy of a list without mutating the original.

const next = reorder({
list: tasks,
startIndex: 0,
finishIndex: 2,
});