mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 04:25:01 +00:00
Fix extra denied permissions on companion channels
This commit is contained in:
parent
c86abb04a0
commit
220b28d484
2 changed files with 17 additions and 1 deletions
13
backend/src/utils/filterObject.ts
Normal file
13
backend/src/utils/filterObject.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Filter an object's properties based on its values and keys
|
||||
* @return New object with filtered properties
|
||||
*/
|
||||
export function filterObject<T extends Record<string | number | symbol, unknown>>(
|
||||
object: T,
|
||||
filterFn: <K extends keyof T>(value: T[K], key: K) => boolean,
|
||||
): Record<keyof T, T[keyof T]> {
|
||||
return Object.fromEntries(Object.entries(object).filter(([key, value]) => filterFn(value as any, key))) as Record<
|
||||
keyof T,
|
||||
T[keyof T]
|
||||
>;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue