MCPcopy
hub / github.com/angular-ui/ui-router / buildUrl

Function buildUrl

test/angular/1.3/angular.js:9757–9780  ·  view source on GitHub ↗
(url, params)

Source from the content-addressed store, hash-verified

9755
9756
9757 function buildUrl(url, params) {
9758 if (!params) return url;
9759 var parts = [];
9760 forEachSorted(params, function(value, key) {
9761 if (value === null || isUndefined(value)) return;
9762 if (!isArray(value)) value = [value];
9763
9764 forEach(value, function(v) {
9765 if (isObject(v)) {
9766 if (isDate(v)) {
9767 v = v.toISOString();
9768 } else {
9769 v = toJson(v);
9770 }
9771 }
9772 parts.push(encodeUriQuery(key) + '=' +
9773 encodeUriQuery(v));
9774 });
9775 });
9776 if (parts.length > 0) {
9777 url += ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&');
9778 }
9779 return url;
9780 }
9781 }];
9782}
9783

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