export const gamePath = (name, id, params) => {
    return apiPath("game/" + name + "/" + id + "/", params);
}

export const apiPath = (path, params) => {
    //API_HOST is defined in index.html
    const url = API_HOST + '/api/' + path;

    if (!params) return url;

    let parts = [];
    for (let [key, value] of Object.entries(params)) {
        parts.push(key + "=" + value);
    }

    return url + "?" + parts.join("&");
}

//getProperty returns the given prop name out of the object. propName may be a
//string or an array of string fields. if propNames has a dot, then it will be
//split on those items. Handles undefined fine.
export const getProperty = (obj, propNames) => {
    if (!obj) return undefined;
    if (typeof obj != "object") return undefined;
    if (!propNames) return undefined;
    if (typeof propNames == "string") propNames = propNames.split(".");
    let propName = propNames.shift();
    let prop = obj[propName];
    //That was the last name in the chain
    if (propNames.length == 0) return prop;
    return getProperty(prop, propNames);
}
@@ -1065,12 +1065,609 @@
 ropNames);%0A%7D
+%0A%0A//setProperty sets the given propName to val. Will return true if it was%0A//successfully set, false if there was an error in the shape.%0Aexport const setProperty = (obj, propNames, val) =%3E %7B%0A    if (!obj) return false;%0A    if (typeof obj != %22object%22) return false;%0A    if (!propNames) return false;%0A    if (typeof propNames == %22string%22) propNames = propNames.split(%22.%22);%0A    let propName = propNames.shift();%0A    //That was the last name in the chain%0A    if (propNames.length == 0) %7B%0A        obj%5BpropName%5D = val;%0A        return true;%0A    %7D;%0A    return setProperty(obj%5BpropName%5D, propNames, val);%0A%7D

Add a setProperty util function akin to getProperty. Part of #614.