Returns directory path
@param {Number} length
@param {Array} parts
@returns {String} directory path
192158
function getPathDirectory(length, parts) {
  if (!parts) {
    return '';
  }
  return parts
    .slice(length)
    .filter(part => part !== '')
    .join(path.sep);
}
1266285
function _mkdirpSync (directory, mode) {

			if ("undefined" === typeof directory) {
				throw new ReferenceError("missing \"directory\" argument");
			}
				else if ("string" !== typeof directory) {
					throw new TypeError("\"directory\" argument is not a string");
				}
				else if ("" === directory.trim()) {
					throw new Error("\"directory\" argument is empty");
				}
			else if ("undefined" !== typeof mode && "number" !== typeof mode) {
				throw new TypeError("\"mode\" argument is not a number");
			}
			else if (!isDirectorySync(directory)) {

				const SUB_DIRECTORY = dirname(directory);

				if (!isDirectorySync(SUB_DIRECTORY)) {
					_mkdirpSync(SUB_DIRECTORY);
				}

				mkdirSync(directory, mode ? mode : DEFAULT_OPTION);

			}

		}
1001786
function (pathParts) {
            var path = [pathParts[0]];
            for (var index = 1, len = pathParts.length; index < len; index++) {
                path.push("[\"" + ("" + pathParts[index]).replace(/"/gi, '\\"') + "\"]");
            }
            return path.join('');
        }
1260661
function mkdir(root, mode, callback) {

  if (typeof mode === 'function') {
    var callback = mode;
    var mode = null;
  }
  if (typeof root !== 'string') {
    throw new Error('missing root');
  } else if (typeof callback !== 'function') {
    throw new Error('missing callback');
  }

  var chunks = root.split(path.sep); // split in chunks
  var chunk;
  if (path.isAbsolute(root) === true) { // build from absolute path
    chunk = chunks.shift(); // remove "/" or C:/
    if (!chunk) { // add "/"
      chunk = path.sep;
    }
  } else {
    chunk = path.resolve(); // build with relative path
  }

  return mkdirRecursive(chunk, chunks, mode, callback);
}
296395
def paths_in_directory(input_directory):
    
    paths = []
    for base_path, directories, filenames in os.walk(input_directory):
        relative_path = os.path.relpath(base_path, input_directory)
        path_components = relative_path.split(os.sep)
        if path_components[0] == ".":
            path_components = path_components[1:]
        if path_components and path_components[0].startswith("."):
            # hidden dir
            continue
        path_components = filter(bool, path_components)  # remove empty components
        for filename in filenames:
            if filename.startswith("."):
                # hidden file
                continue
            paths.append(path_components + [filename])
    return paths
158176
function _getVectorY(params, angle, length) {
	angle *= params._toRad;
	angle -= (PI / 2);
	return (length * sin(angle));
}
710993
function _getFirstDirectory(dir) {
  var files = glob.sync(dir + '/*');

  for (var i = files.length; i--; ) {
    var file = files[i];
    if (fs.statSync(file).isDirectory()) return file;
  }

  return false;
}
1051393
function normalizePath(dir) {
  if(dir && dir[dir.length - 1] != path.sep) {
    dir += path.sep;
  }
  return dir;
}
1218637
def include_dir(self, root):
        """"""
        parts = [root]
        parts.extend(self.pathname.split(os.path.sep))
        return "/".join(parts)
1272855
function generatePathString(paths) {
  let pathString = '';

  if (!paths || !paths.length) return pathString;

  if (paths.length > 1) {
    pathString = paths.map(pathItem => filepathName(pathItem));
    // Trim long lists
    if (pathString.length > maxInputStringLength) {
      const remainder = pathString.length - maxInputStringLength;

      pathString = `${pathString
        .slice(0, maxInputStringLength)
        .join(', ')} ...and ${remainder} other${remainder > 1 ? 's' : ''}`;
    } else {
      pathString = pathString.join(', ');
    }
  } else {
    pathString = filepathName(paths[0]);
  }

  return pathString;
}
12295
function (path) {
            var result = path.match(splitPathRe) || [],
                root = result[1] || '',
                dir = result[2] || '';

            if (!root && !dir) {
                // No dirname
                return '.';
            }

            if (dir) {
                // It has a dirname, strip trailing slash
                dir = dir.substring(0, dir.length - 1);
            }

            return root + dir;
        }
264084
function (path) {
        if (path[path.length - 1] === '/') {
            path = path.substr(0, path.length - 1);
        }
        return path;
    }
983449
function ensureTrailingDirectorySeparator(path) {
        if (path.charAt(path.length - 1) !== ts.directorySeparator) {
            return path + ts.directorySeparator;
        }
        return path;
    }
103367
function getModulePath(module) {
    if (!module || !module.id) return ""

    var parts = module.id.split("/")

    return parts.slice(0, parts.length-1).join("/")
}
254528
function getPostPaths (dir) {
  return fs.readdir(dir).then(function (files) {
    return all(files.map(function (file) {
      var path = pathify(dir, file);
      return fs.stat(path).then(function (stats) {
        return stats.isDirectory() ?
          getPostPaths(path) :
          path;
      });
    }));
  }).then(function (files) {
    return _.flatten(files);
  });
}
692287
function mkdirSync(root, mode) {

  if (typeof root !== 'string') {
    throw new Error('missing root');
  }

  var chunks = root.split(path.sep); // split in chunks
  var chunk;
  if (path.isAbsolute(root) === true) { // build from absolute path
    chunk = chunks.shift(); // remove "/" or C:/
    if (!chunk) { // add "/"
      chunk = path.sep;
    }
  } else {
    chunk = path.resolve(); // build with relative path
  }

  return mkdirSyncRecursive(chunk, chunks, mode);
}
884903
def ensure_dir(self, *path_parts):
        
        path = self.getpath(*path_parts)
        ensure_directory(path)
        return path