global: snapshot

This commit is contained in:
nym21
2026-03-29 23:10:31 +02:00
parent f6960c61d6
commit d038141a8a
15 changed files with 1367 additions and 4883 deletions

View File

@@ -23,3 +23,12 @@ export const fromEntries = (pairs) => /** @type {Record<K, V>} */ (Object.fromEn
* @returns {value is T}
*/
export const includes = (arr, value) => arr.includes(/** @type {T} */ (value));
/**
* @template T
* @param {readonly T[]} arr
* @returns {T}
*/
export function randomFromArray(arr) {
return arr[Math.floor(Math.random() * arr.length)];
}