lib/services/sites.js
function normalizeDirectory(dir) {
  if (!dir || dir === path.sep) {
    dir = '.';
  } else if (_.head(dir) === path.sep) {
    dir = dir.substr(1);
  }

  if (dir.length > 1 && _.last(dir) === path.sep) {
    dir = dir.substring(0, dir.length - 1);
  }

  return dir;
}
function normalizeDirectory(dir) {
  if (!dir || dir === path.sep) {
    dir = '.';
  } else if (_.head(dir) === path.sep) {
    dir = dir.substr(1);
  }

  if (dir.length > 1 && _.last(dir) === path.sep) {
    dir = dir.substring(0, dir.length - 1);
  }

  return dir;
}
function normalizeDirectory ( dir ) { if ( ! dir || dir === path . sep ) { dir = '.' ; } else if ( _ . head ( dir ) === path . sep ) { dir = dir . substr ( 1 ) ; } if ( dir . length > 1 && _ . last ( dir ) === path . sep ) { dir = dir . substring ( 0 , dir . length - 1 ) ; } return dir ; }
Normalize directory to never start with slash, never end with slash, and always exist
@param {string} dir
@returns {string}
Normalize directory to never start with slash never end with slash and always exist