mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-13 09:13:08 +02:00
8 lines
260 B
TypeScript
8 lines
260 B
TypeScript
|
import { stringify } from 'querystring';
|
||
|
|
||
|
export function query(obj: {}): string {
|
||
|
return stringify(Object.entries(obj)
|
||
|
.filter(([, v]) => Array.isArray(v) ? v.length : v !== undefined)
|
||
|
.reduce((a, [k, v]) => (a[k] = v, a), {} as Record<string, any>));
|
||
|
}
|