UNPKG

diginext-utils

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