mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-16 06:01:56 +01:00
de47a17be7
* Improve drive file downloading * fix name * wtf crlf * semicolon
11 lines
409 B
TypeScript
11 lines
409 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>));
|
|
}
|
|
|
|
export function appendQuery(url: string, query: string): string {
|
|
return `${url}${/\?/.test(url) ? url.endsWith('?') ? '' : '&' : '?'}${query}`;
|
|
}
|