shift()
shift<
T>(arr): [T,T[]]
Returns a tuple containing the first element (head) of the given array and the remaining elements of the array (tail).
Type Parameters
T
T
The type of array elements.
Parameters
arr
T[]
The element to get the head/tail of.
Returns
[T, T[]]
Remarks
pure function
Example
import { shift } from '@accelint/core';
shift([1, 2, 3, 4]);
// [1, [2, 3, 4, 5]]