MCPcopy Index your code
hub / github.com/angular-ui/ui-router / buildUrl

Function buildUrl

test/angular/1.2/angular.js:8507–8530  ·  view source on GitHub ↗
(url, params)

Source from the content-addressed store, hash-verified

8505
8506
8507 function buildUrl(url, params) {
8508 if (!params) return url;
8509 var parts = [];
8510 forEachSorted(params, function(value, key) {
8511 if (value === null || isUndefined(value)) return;
8512 if (!isArray(value)) value = [value];
8513
8514 forEach(value, function(v) {
8515 if (isObject(v)) {
8516 if (isDate(v)){
8517 v = v.toISOString();
8518 } else {
8519 v = toJson(v);
8520 }
8521 }
8522 parts.push(encodeUriQuery(key) + '=' +
8523 encodeUriQuery(v));
8524 });
8525 });
8526 if(parts.length > 0) {
8527 url += ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&');
8528 }
8529 return url;
8530 }
8531 }];
8532}
8533

Callers 1

sendReqFunction · 0.70

Calls 8

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

Tested by

no test coverage detected