diginext-utils
Version:
README.md
16 lines • 430 B
TypeScript
/**
* Returns the last element of an array.
*
* @template T - The type of elements in the array
* @param array - The array to get the last element from
* @returns The last element, or undefined if array is empty
*
* @example
* ```ts
* last([1, 2, 3]); // 3
* last([]); // undefined
* last(['a', 'b', 'c']); // 'c'
* ```
*/
export declare function last<T>(array: T[]): T | undefined;
//# sourceMappingURL=last.d.ts.map