format input path
@param {string} path
@param {string} sep - path separator
766785
function formatAsElegantPath(path, sep) {
    const chalk = require('chalk');
    const packages = path.split(sep);
    const lastIndex = packages.length - 1;

    // prettier-ignore
    const result = packages
        .map((item) => item.trim())
        .map((item, index) => {
            return index === lastIndex
                ? chalk.red.bold(item)
                : item;
        })
        .join(' -> ');
    return result;
}
696498
function splitLastKey (path) {
  let pathArr = path.split('.')
  if (pathArr.length >= 2) {
    let patentObjectPath = pathArr.splice(0, pathArr.length - 1) || []// pathArr -> key
    return [pathArr, patentObjectPath.join('.')]
  } else {
    return [pathArr]
  }
}
755794
public static function Make($path, $extras=array(), $sep="/")
	{
		$ext = "";

		if (sizeof($extras) > 0)
			foreach ($extras as $e)
				$ext .= (string) $e . $sep;


		/* dont seperate if no extras were provided */

		if ($ext != "")
			return $path . $sep . $ext;
		

		return $path;
	}
473558
function(path)
	{
		if (path != null)
		{
			var index = path.lastIndexOf(mxCellPath.PATH_SEPARATOR);

			if (index >= 0)
			{
				return path.substring(0, index);
			}
			else if (path.length > 0)
			{
				return '';
			}
		}

		return null;
	}
166822
function reformatPaths(paths) {
	let output = {};
	
	if (!paths) {
		return output;
	}
	
	let pathsKeys = Object.keys(paths);
	
	pathsKeys.forEach(function (eachKey) {
		let newKey = eachKey;
		
		if (eachKey.includes("{") && eachKey.includes("}")) {
			// replace : {params} by :params
			newKey = newKey.replace(new RegExp('{', 'g'), ':');
			newKey = newKey.replace(new RegExp('}', 'g'), '');
		}
		
		output[newKey] = paths[eachKey];
	});
	
	return output;
}
537273
function removeTrailingDirectorySeparator(path) {
        if (path.charAt(path.length - 1) === ts.directorySeparator) {
            return path.substr(0, path.length - 1);
        }
        return path;
    }
695099
public static String normalizePath(String path)
  {
    if(File.separatorChar == '/') {
      return path.replace('\\', '/');
    }
    return path.replace('/', '\\');
  }
1051393
function normalizePath(dir) {
  if(dir && dir[dir.length - 1] != path.sep) {
    dir += path.sep;
  }
  return dir;
}
1018828
private function formatPath($path) {
	if($this->dynamic_fileroot != '') {
		$a = explode($this->separator, $path);
		return end($a);
	} else {
		return $path;
	}
}
264084
function (path) {
        if (path[path.length - 1] === '/') {
            path = path.substr(0, path.length - 1);
        }
        return path;
    }
1282810
function(path) {
    var p = path || this.path(); 
    var pp = (!p || p == "/")? null : p.substring(0, p.lastIndexOf("/"));
    return (pp=="")? "/" : pp;
  }
131060
function formatProjectPath(filePath = '') {
  let dir = path.relative(process.cwd(), path.dirname(filePath));
  return dir + (dir ? path.sep : '') + path.basename(filePath);
}
755390
function normalize(path) {
  var last = path.length - 1
  var lastC = path.charCodeAt(last)

  // If the uri ends with `#`, just return it without '#'
  if (lastC === 35 /* "#" */) {
    return path.substring(0, last)
  }

  return (path.substring(last - 2) === ".js" ||
      path.indexOf("?") > 0 ||
      lastC === 47 /* "/" */) ? path : path + ".js"
}
419072
private static String formatPathToFile(Path path) {
    return StringUtils.removeEnd(path.toString(), Path.SEPARATOR);
  }
149962
function (path) {
        if (_.isArray(path)) {
            return path;
        } else if (_.isString(path)) {
            return path.split('.');
        }
    }
499587
function _splitPath (keys) {
  var out

  if (util.isString(keys)) {
    out = []
    keys
      .split('.')
      .map(_segment('.'))
      .forEach(function (k) {
        k = (k || ' ').trim()
          .replace(/^([^[]+)\[(["']?)(.+)\2\]$/, function (m, m1, m2, m3) {
            if (m1 && m3) {
              out.push(m1, m3)
            }
            return ''
          })
        if (k) {
          out.push(k)
        }
      })
    keys = out
  }
  return keys
}
374475
public static String format(String[] d, String sep) {
    if(d == null) {
      return "null";
    }
    if(d.length == 0) {
      return "";
    }
    if(d.length == 1) {
      return d[0];
    }
    int len = sep.length() * (d.length - 1);
    for(String s : d) {
      len += s.length();
    }
    StringBuilder buffer = new StringBuilder(len)//
        .append(d[0]);
    for(int i = 1; i < d.length; i++) {
      buffer.append(sep).append(d[i]);
    }
    return buffer.toString();
  }