MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / buildUrl

Function buildUrl

code/songhop/www/lib/angular/angular.js:9646–9669  ·  view source on GitHub ↗
(url, params)

Source from the content-addressed store, hash-verified

9644
9645
9646 function buildUrl(url, params) {
9647 if (!params) return url;
9648 var parts = [];
9649 forEachSorted(params, function(value, key) {
9650 if (value === null || isUndefined(value)) return;
9651 if (!isArray(value)) value = [value];
9652
9653 forEach(value, function(v) {
9654 if (isObject(v)) {
9655 if (isDate(v)) {
9656 v = v.toISOString();
9657 } else {
9658 v = toJson(v);
9659 }
9660 }
9661 parts.push(encodeUriQuery(key) + '=' +
9662 encodeUriQuery(v));
9663 });
9664 });
9665 if (parts.length > 0) {
9666 url += ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&');
9667 }
9668 return url;
9669 }
9670 }];
9671}
9672

Callers 1

sendReqFunction · 0.70

Calls 7

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