commondir
compute the closest common parent for file paths
common-path-prefix
Computes the longest prefix string that is common to each path, excluding the base component
common-path
Finds the longest common parent directory path in an array of file path strings or custom objects. Also returns sub and base parts for each path.