MCPcopy
hub / github.com/ampproject/amphtml / serializeQueryString

Function serializeQueryString

src/url.js:269–283  ·  view source on GitHub ↗
(params)

Source from the content-addressed store, hash-verified

267 * @return {string}
268 */
269export function serializeQueryString(params) {
270 const s = [];
271 for (const k in params) {
272 let v = params[k];
273 if (v == null) {
274 continue;
275 }
276
277 v = arrayOrSingleItemToArray(v);
278 for (let i = 0; i < v.length; i++) {
279 s.push(urlEncodeKeyValue(k, v[i]));
280 }
281 }
282 return s.join('&');
283}
284
285/**
286 * Returns `true` if the URL is secure: either HTTPS or localhost (for testing).

Callers 15

test-url.jsFile · 0.90
setupJsonFetchInitFunction · 0.90
getEncodedLocation_Method · 0.90
directadvertFunction · 0.90
authorizeOnServer_Method · 0.90
defaultSerializerFunction · 0.90

Calls 3

arrayOrSingleItemToArrayFunction · 0.90
urlEncodeKeyValueFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected