import type { Arr, Element, ElementNotUndefined } from '@toolbox-ts/types/defs/array'; /** * Returns the element at the specified index of an array, `undefined` if out of bounds, or `fallbackIfUndefined` if undefined. * * @example * ```ts * at([1, 2, 3], 1) // 2 * at([1, 2, 3], -1) // 3 * at([1, 2, 3], 5) // undefined * at([1, 2, 3], 5, null) // null * ``` */ export declare const at: (arr: T, index: number, fallbackIfUndefined?: F) => Exclude, undefined> | F; /** * Returns the element at the specified index of an array. * * @throws `Error` if the index is out of bounds. * * @example * ```ts * atOrThrow([1, 2, 3], 1) // 2 * atOrThrow([1, 2, 3], -1) // 3 * atOrThrow([1, 2, 3], 5) // throws Error * ``` */ export declare const atOrThrow: (arr: T, index: number) => ElementNotUndefined; /** * Returns the last index of an array, -1 if empty. * * @example * ```ts * lastIndex([1, 2, 3]) // 2 * lastIndex([]) // -1 * ``` */ export declare const lastIndex: (arr: T) => number; /** * Returns the last element of an array, or undefined if empty. * @example * ```ts * last([1, 2, 3]) // 3 * last([]) // undefined * ``` */ export declare const last: (arr: T) => Element; /** * Returns the last element of an array. * * @throws `Error` if the array is empty. * @example * ```ts * lastOrThrow([1, 2, 3]) // 3 * lastOrThrow([]) // throws Error * ``` */ export declare const lastOrThrow: (arr: T) => ElementNotUndefined; /** * Returns the first element of an array, or undefined if empty. * * @example * ```ts * first([1, 2, 3]) // 1 * first([]) // undefined * ``` */ export declare const first: (arr: T) => Element; /** * Returns the first element of an array. * * @throws `Error` if the array is empty. * * @example * ```ts * firstOrThrow([1, 2, 3]) // 1 * firstOrThrow([]) // throws Error * ``` */ export declare const firstOrThrow: (arr: T) => ElementNotUndefined;