index.js
function pack(href, API_URL) {
  var parts = url.parse(href);
  var pn = API_URL.pathname || '/';
  if (parts.host !== API_URL.host || parts.pathname.indexOf(pn) !== 0) return href;
  if (pn === '/') pn = '';
  return parts.pathname.replace(pn, '~') + (parts.search || '');
}
function pack(href, API_URL) {
  var parts = url.parse(href);
  var pn = API_URL.pathname || '/';
  if (parts.host !== API_URL.host || parts.pathname.indexOf(pn) !== 0) return href;
  if (pn === '/') pn = '';
  return parts.pathname.replace(pn, '~') + (parts.search || '');
}
function pack ( href , API_URL ) { var parts = url . parse ( href ) ; var pn = API_URL . pathname || '/' ; if ( parts . host !== API_URL . host || parts . pathname . indexOf ( pn ) !== 0 ) return href ; if ( pn === '/' ) pn = '' ; return parts . pathname . replace ( pn , '~' ) + ( parts . search || '' ) ; }
replace the API_URL with ~
replace the API_URL with ~