/** * Removes undefined entries from object */ function removeUndefinedFromObject(obj: Record): object { return Object.entries(obj).reduce((acc, curEntry) => { const [key, val] = curEntry if (val !== undefined) acc[key] = val return acc }, {} as Record) } async function sleep(ms: number): Promise { return await new Promise((resolve) => setTimeout(resolve, ms)) } function addProtocolIfNotPresent(host: string): string { if (!(host.startsWith('https://') || host.startsWith('http://'))) { return `http://${host}` } return host } export { sleep, removeUndefinedFromObject, addProtocolIfNotPresent }