UNPKG

@charpeni/one-of

Version:

Type-safe utilities to return a random element from an array or random entry from an object

12 lines 255 B
//#region src/oneElementOf.d.ts /** * Returns one random element from the array. * * @example * ```ts * oneElementOf([1, 2, 3]); // 2 * ``` */ declare function oneElementOf<const T>(array: ReadonlyArray<T>): T; //#endregion export { oneElementOf };