UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

20 lines 418 B
//#region src/array/random.d.ts /** * `random(array)` * * Returns a random element from `array`, or `undefined` if the array is empty. * * ```ts * random([1, 2, 3, 4]); // 2 (random) * ``` * * ```ts * pipe([1, 2, 3, 4], random()); // 2 (random) * ``` */ declare const random: { (): <T>(target: readonly T[]) => T | undefined; <T>(target: readonly T[]): T | undefined; }; //#endregion export { random };