Fix #31
This commit is contained in:
		
							parent
							
								
									043ffe3a2e
								
							
						
					
					
						commit
						de81437248
					
				|  | @ -1,13 +1,17 @@ | |||
| import autobind from 'autobind-decorator'; | ||||
| import { EventEmitter } from 'eventemitter3'; | ||||
| import ReconnectingWebsocket from 'reconnecting-websocket'; | ||||
| import { stringify } from 'querystring'; | ||||
| import { BroadcastEvents, Channels } from './streaming.types'; | ||||
| 
 | ||||
| function urlQuery(obj: Record<string, unknown>): string { | ||||
| 	return stringify(Object.entries(obj) | ||||
| export function urlQuery(obj: Record<string, unknown>): string { | ||||
| 	const params = Object.entries(obj) | ||||
| 		.filter(([, v]) => Array.isArray(v) ? v.length : v !== undefined) | ||||
| 		.reduce((a, [k, v]) => (a[k] = v, a), {} as Record<string, any>)); | ||||
| 		.reduce((a, [k, v]) => (a[k] = v, a), {} as Record<string, unknown>); | ||||
| 
 | ||||
| 	return Object.entries(params) | ||||
| 		.map((e) => `${e[0]}=${e[1]}`) | ||||
| 		.map((e) => `${e[0]}=${encodeURIComponent(e[1])}`) | ||||
| 		.join('&'); | ||||
| } | ||||
| 
 | ||||
| type AnyOf<T extends Record<any, any>> = T[keyof T]; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue