(url: string, params: QueryParams = {})
| 21 | }; |
| 22 | |
| 23 | export const appendQueryParams = (url: string, params: QueryParams = {}): string => { |
| 24 | const hasParamsRegex = /\?([\w]+=[\w]+)/; |
| 25 | const alreadyHasParams = hasParamsRegex.test(url); |
| 26 | |
| 27 | const stringified = `${Object.entries(params).reduce((next, [key, value]) => { |
| 28 | return next + `${key}=${value}&`; |
| 29 | }, '').slice(0, -1)}`; |
| 30 | |
| 31 | return `${url}${alreadyHasParams ? '&' : '?'}${stringified}`; |
| 32 | }; |
| 33 | |
| 34 | export const setUpSocketIOPing = (sendMessage: SendMessage, interval = SOCKET_IO_PING_INTERVAL): any => { |
| 35 | const ping = () => sendMessage(SOCKET_IO_PING_CODE); |
no outgoing calls
no test coverage detected
searching dependent graphs…