mirror of
https://github.com/hanzo-io/chat.git
synced 2026-10-30 18:57:58 +00:00
20 lines
412 B
TypeScript
20 lines
412 B
TypeScript
/**
|
|
* Function to check if a string exists in a list
|
|
* @param list
|
|
* @param item
|
|
* @returns
|
|
*/
|
|
export const in_list = (list: string[], item?: string): boolean => {
|
|
if (item === undefined) return false
|
|
|
|
return list.includes(item)
|
|
}
|
|
|
|
/**
|
|
* Function to check if an object is empty
|
|
* @param obj
|
|
* @returns
|
|
*/
|
|
export const isEmpty = (obj: object) => {
|
|
return Object.keys(obj).length === 0;
|
|
} |