Initial commit
CI / check (push) Successful in 56s

This commit is contained in:
rudder
2026-08-12 14:02:25 +03:00
commit 3ab2d4a6cf
85 changed files with 10257 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
/**
* URL utility helpers for encoding and query string construction.
*/
/** URL-encodes a single value for use in path/query segments. */
export function encodeUrl(value: string): string {
return encodeURIComponent(value);
}
/**
* Builds a query string from an array of key-value pairs.
* Null/undefined/empty values are skipped.
* Returns an empty string if no valid params, or a leading `?` followed by the query.
*/
export function buildQuery(params: Array<[string, string | null | undefined]>): string {
const parts: string[] = [];
for (const [key, value] of params) {
if (value != null && value !== '') {
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
}
}
return parts.length === 0 ? '' : `?${parts.join('&')}`;
}