API reference › @evolu/common › Array › shiftFromArray
function shiftFromArray<T>(array: [T, ...T[]]): T;
Defined in: packages/common/src/Array.ts:774
Shifts (removes and returns) the first element from a non-empty mutable array.
Mutates the original array.
Example
// Process a queue of callbacks
const waitingQueue: Array<() => void> = [callback1, callback2];
if (isNonEmptyArray(waitingQueue)) {
shiftFromArray(waitingQueue)(); // Remove and immediately invoke
}