function appendToURLQuery(url, queryParts) {
    const urlParsed = new URL(url);
    let query = urlParsed.search;
    if (query) {
        query += "&" + queryParts;
    }
    else {
        query = queryParts;
    }
    urlParsed.search = query;
    return urlParsed.toString();
}
Append a string to URL query.

@param url - Source URL string.
@param queryParts - String to be appended to the URL query.
@returns An updated URL string.