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