function collapseLeadingSlashes(str) {
  for (var i = 0; i < str.length; i++) {
    if (str[i] !== "/") {
      break;
    }
  }
  return i > 1 ? "/" + str.substr(i) : str;
}
/**
 * Collapse all leading slashes into a single slash
 *
 * @param {string} str
 * @private
 */
Collapse all leading slashes into a single slash
@param {string} str
@private
Collapse all leading slashes into a single slash @param { string } str @private
function collapseLeadingSlashes(str) {
  for (var i = 0; i < str.length; i++) {
    if (str[i] !== "/") {
      break;
    }
  }
  return i > 1 ? "/" + str.substr(i) : str;
}
function collapseLeadingSlashes ( str ) { for ( var i = 0 ; i < str . length ; i ++ ) { if ( str [ i ] !== "/" ) { break ; } } return i > 1 ? "/" + str . substr ( i ) : str ; }
Collapse all leading slashes into a single slash
 @param {string} str
 @private
Collapse all leading slashes into a single slash @param { string } str @private