src/url.js
/**
 * Removes parameters that start with amp js parameter pattern and returns the new
 * search string.
 * @param {string} urlSearch
 * @return {string}
 */
Removes parameters that start with amp js parameter pattern and returns the new
search string.
@param {string} urlSearch
@return {string}
Removes parameters that start with amp js parameter pattern and returns the new search string . @param { string } urlSearch @return { string }
function removeAmpJsParams(urlSearch) {
  if (!urlSearch || urlSearch == '?') {
    return '';
  }
  const search = urlSearch
      .replace(AMP_JS_PARAMS_REGEX, '')
      .replace(/^[?&]/, '');  
  return search ? '?' + search : '';
}
function removeAmpJsParams ( urlSearch ) { if ( ! urlSearch || urlSearch == '?' ) { return '' ; } const search = urlSearch . replace ( AMP_JS_PARAMS_REGEX , '' ) . replace ( / ^[?&] / , '' ) ; return search ? '?' + search : '' ; }
Removes parameters that start with amp js parameter pattern and returns the new
 search string.
Removes parameters that start with amp js parameter pattern and returns the new search string .
// Removes first ? or &.