website: redesign part 1

This commit is contained in:
nym21
2026-06-03 12:34:05 +02:00
parent 5f5563fece
commit 90e8741fb7
209 changed files with 23945 additions and 176 deletions
-34
View File
@@ -1,34 +0,0 @@
/**
* Typed Object.entries that preserves key types
* @template {Record<string, unknown>} T
* @param {T} obj
* @returns {[keyof T & string, T[keyof T & string]][]}
*/
export const entries = (obj) => /** @type {[keyof T & string, T[keyof T & string]][]} */ (Object.entries(obj));
/**
* Typed Object.fromEntries that preserves key/value types
* @template {string} K
* @template V
* @param {Iterable<readonly [K, V]>} pairs
* @returns {Record<K, V>}
*/
export const fromEntries = (pairs) => /** @type {Record<K, V>} */ (Object.fromEntries(pairs));
/**
* Type-safe includes that narrows the value type
* @template T
* @param {readonly T[]} arr
* @param {unknown} value
* @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)];
}