Node module that finds the deepest common folder from an array of given paths
This module takes in an array of path strings and determines the deepest common folder. This means that it finds the deepest possible parent folder that is shared by all paths in the passed array.
npm i -S deepest-common-folder
npm run test
Below is an example of how this module can be used. Please note that if an empty array is passed, then /
will be returned. Also if relative paths are used, they will be resolved based on the CWD. An absolute path with a trailing /
will always be returned. If a non-array is passed, then an exception is thrown.
const dcf = require ("deepest-common-folder")
let paths = [
"/foo/bar",
"/foo/bar/baz",
"/foo/baz",
"/foo/baz/bar"
]
let folder = dcf ( paths )