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

Function addMissingParamsToUrl

src/url.js:250–261  ·  view source on GitHub ↗
(url, params)

Source from the content-addressed store, hash-verified

248 * @return {string}
249 */
250export function addMissingParamsToUrl(url, params) {
251 const location = parseUrlDeprecated(url);
252 const existingParams = parseQueryString(location.search);
253 const paramsToAdd = {};
254 const keys = Object.keys(params);
255 for (let i = 0; i < keys.length; i++) {
256 if (!hasOwn(existingParams, keys[i])) {
257 paramsToAdd[keys[i]] = params[keys[i]];
258 }
259 }
260 return addParamsToUrl(url, paramsToAdd);
261}
262
263/**
264 * Serializes the passed parameter map into a query string with both keys

Callers 3

test-url.jsFile · 0.90
maybeAppendLinker_Method · 0.90

Calls 4

parseQueryStringFunction · 0.90
hasOwnFunction · 0.90
parseUrlDeprecatedFunction · 0.85
addParamsToUrlFunction · 0.85

Tested by

no test coverage detected