lib/trim-slash.js
function trimSlash(string) {
  if (typeof string !== 'string') {
    return string;
  }
  if (string.length > 0 && string.charAt(string.length - 1) === '/') {
    return string.slice(0, string.length - 1);
  }
  return string;
}
function trimSlash(string) {
  if (typeof string !== 'string') {
    return string;
  }
  if (string.length > 0 && string.charAt(string.length - 1) === '/') {
    return string.slice(0, string.length - 1);
  }
  return string;
}
Trims a single slash from the end of a string, if present.
@ template ArgType
@param {ArgType} string String to trim.
@return {ArgType} If <code>string</code> is a string which ends with
<code>'/'</code>, <code>string</code> with the last character removed.
Otherwise, <code>string</code> unmodified.
@ nosideeffects