UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

17 lines 501 B
/** * Gets the last element of `array`. * @param array the array * @param defaultValue default value * @signature * P.last(array) * P.last(array, default) * @example * P.last([1, 2, 3]) // => 3 * P.last([]) // => undefined * P.last([], 2) // => 2 * P.last([1], 2) // => 1 * @category Array */ export declare function last<T>(array: readonly T[]): T | undefined; export declare function last<T>(array: readonly T[], defaultValue: T): T; //# sourceMappingURL=last.d.ts.map