MCPcopy Create free account
hub / github.com/CSAILVision/gandissect / urlString

Method urlString

client_dist/ganclient.js:496–513  ·  view source on GitHub ↗

* Generates an URL string from a map of url parameters * @param {{}} urlParameters - the map of parameters * @returns {string} - an URI string

(urlParameters)

Source from the content-addressed store, hash-verified

494 * @returns {string} - an URI string
495 */
496 static urlString(urlParameters) {
497 const attr = [];
498 Object.keys(urlParameters).forEach(k => {
499 const v = urlParameters[k];
500 if (v !== undefined) {
501 let value = v;
502 if (Array.isArray(v))
503 value = '..' + v.join(',');
504 attr.push(encodeURI(k + '=' + value));
505 }
506 });
507 const url = window.location.pathname;
508 let res = url.substring(url.lastIndexOf('/') + 1);
509 if (attr.length > 0) {
510 res += '?' + attr.join('&');
511 }
512 return res;
513 }
514 static updateURLParam(key, value, addToBrowserHistory = true) {
515 const currentParams = URLHandler.parameters;
516 currentParams[key] = value;

Callers 1

updateUrlMethod · 0.45

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected