@monstermann/fn
Version:
A utility library for TypeScript.
20 lines • 386 B
TypeScript
//#region src/array/last.d.ts
/**
* `last(array)`
*
* Returns the last element of `array`, or `undefined` if the array is empty.
*
* ```ts
* last([1, 2, 3, 4]); // 4
* ```
*
* ```ts
* pipe([1, 2, 3, 4], last()); // 4
* ```
*/
declare const last: {
(): <T>(target: readonly T[]) => T | undefined;
<T>(target: readonly T[]): T | undefined;
};
//#endregion
export { last };