API reference / @evolu/common / Array / shiftArray
Function: shiftArray()
function shiftArray<T>(array): T;
Defined in: packages/common/src/Array.ts:416
Shifts an item from a non-empty mutable array, guaranteed to return T.
Mutates the original array.
Example
const arr: NonEmptyArray<number> = [1, 2, 3];
shiftArray(arr); // 1
arr; // [2, 3]
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
array | [T, ...T[]] |
Returns
T