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

Function removeAmpJsParamsFromSearch

src/url.js:459–469  ·  view source on GitHub ↗

* Removes parameters that start with amp js parameter pattern and returns the * new search string. * @param {string} urlSearch * @return {string}

(urlSearch)

Source from the content-addressed store, hash-verified

457 * @return {string}
458 */
459function removeAmpJsParamsFromSearch(urlSearch) {
460 // The below regex is a combo of these original patterns. Combining these,
461 // removing the corresponding `.replace` calls, and reusing
462 // removeParamsFromSearch saves ~175B. Matches params in query string:
463 // - /[?&]amp_js[^&]*/ amp_js_*
464 // - /[?&]amp_gsa[^&]*/ amp_gsa
465 // - /[?&]amp_r[^&]*/ amp_r
466 // - /[?&]amp_kit[^&]*/ amp_kit
467 // - /[?&]usqp[^&]*/ usqp (from goog experiment)
468 return removeParamsFromSearch(urlSearch, '(amp_(js[^&=]*|gsa|r|kit)|usqp)');
469}
470
471/**
472 * Removes parameters with param name and returns the new search string.

Callers 2

removeAmpJsParamsFromUrlFunction · 0.85
getSourceUrlFunction · 0.85

Calls 1

removeParamsFromSearchFunction · 0.85

Tested by

no test coverage detected