mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-21 00:05:34 +08:00
Remove unnecessary func getKey
Addresses: - https://github.com/louislam/uptime-kuma/pull/4717#discussion_r1589856311 - https://github.com/louislam/uptime-kuma/pull/4717#discussion_r1589862733
This commit is contained in:
10
src/util.ts
10
src/util.ts
@@ -642,13 +642,3 @@ export function intHash(str : string, length = 10) : number {
|
||||
// Normalize the hash to the range [0, 10]
|
||||
return (hash % length + length) % length; // Ensure the result is non-negative
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the key from the provided object corresponding to the given value.
|
||||
* @param {object} obj - The object to search.
|
||||
* @param {*} value - The value to search for.
|
||||
* @returns {string|null} - The key associated with the value, or null if not found.
|
||||
*/
|
||||
export function getKey(obj: any, value: string) {
|
||||
return Object.keys(obj).find(key => obj[key] === value) || null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user