last
ts
function Array.last<T>(target: readonly T[]): T | undefinedReturns the last element of array, or undefined if the array is empty.
Example
ts
import { Array } from "@monstermann/array";
Array.last([1, 2, 3, 4]); // 4ts
import { Array } from "@monstermann/array";
pipe([1, 2, 3, 4], Array.last()); // 4