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