MCPcopy Create free account
hub / github.com/bclinkinbeard/angular / buildUrl

Function buildUrl

test/fixtures/foo.js:8399–8422  ·  view source on GitHub ↗
(url, params)

Source from the content-addressed store, hash-verified

8397
8398
8399 function buildUrl(url, params) {
8400 if (!params) return url;
8401 var parts = [];
8402 forEachSorted(params, function(value, key) {
8403 if (value === null || isUndefined(value)) return;
8404 if (!isArray(value)) value = [value];
8405
8406 forEach(value, function(v) {
8407 if (isObject(v)) {
8408 if (isDate(v)){
8409 v = v.toISOString();
8410 } else if (isObject(v)) {
8411 v = toJson(v);
8412 }
8413 }
8414 parts.push(encodeUriQuery(key) + '=' +
8415 encodeUriQuery(v));
8416 });
8417 });
8418 if(parts.length > 0) {
8419 url += ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&');
8420 }
8421 return url;
8422 }
8423 }];
8424}
8425

Callers 1

sendReqFunction · 0.85

Calls 7

forEachSortedFunction · 0.85
isUndefinedFunction · 0.85
forEachFunction · 0.85
isObjectFunction · 0.85
isDateFunction · 0.85
toJsonFunction · 0.85
encodeUriQueryFunction · 0.85

Tested by

no test coverage detected