Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

39
node_modules/es-toolkit/dist/compat/array/sample.d.mts generated vendored Normal file
View File

@@ -0,0 +1,39 @@
//#region src/compat/array/sample.d.ts
/**
* Gets a random element from collection.
*
* @template T
* @param {readonly [T, ...T[]]} collection - The collection to sample.
* @returns {T} Returns the random element.
*
* @example
* sample([1, 2, 3, 4]);
* // => 2
*/
declare function sample<T>(collection: readonly [T, ...T[]]): T;
/**
* Gets a random element from collection.
*
* @template T
* @param {Record<string, T> | Record<number, T> | null | undefined} collection - The collection to sample.
* @returns {T | undefined} Returns the random element.
*
* @example
* sample({ 'a': 1, 'b': 2, 'c': 3 });
* // => 2
*/
declare function sample<T>(collection: Record<string, T> | Record<number, T> | null | undefined): T | undefined;
/**
* Gets a random element from collection.
*
* @template T
* @param {T | null | undefined} collection - The collection to sample.
* @returns {T[keyof T] | undefined} Returns the random element.
*
* @example
* sample({ 'a': 1, 'b': 2, 'c': 3 });
* // => 2
*/
declare function sample<T extends object>(collection: T | null | undefined): T[keyof T] | undefined;
//#endregion
export { sample };