@utilify/core
Version:
Modern, strongly typed, and safe utility function library for JavaScript and TypeScript. Includes type checking, manipulation of arrays, objects, strings, dates, colors, numbers, regular expressions, and more. Compatible with Browser, Node.js, Deno, and B
9 lines • 329 B
TypeScript
/**
* Returns a random element from an array.
* @template T
* @param {T[]} array - The array to sample from.
* @returns {T|undefined} A random element or undefined if empty.
* @throws {TypeError} If array is not an array.
*/
export default function sample<T>(array: T[]): T | undefined;
//# sourceMappingURL=sample.d.ts.map