firstOrThrow
firstOrThrow(array)
Returns the first element of array
, or throws an error if the array is empty.
ts
firstOrThrow([1, 2, 3, 4]); // 1
ts
pipe([1, 2, 3, 4], firstOrThrow()); // 1