package
Returns the parent directory common to each path
npm install common-dirGitHub-flavored package documentation.
Across all versions, last 30 days.
236,782 in 30 days
Runtime metadata.
Tagged topics.
Estimated unpacked size across 2 packages.
12.6 kB
Includes dependencies.
string ⏏Returns the parent directory common to each path.
Kind: Exported function
Returns: string - A single path ending with the path separator, e.g. '/user/some/folder/'
| Param | Type | Description |
|---|---|---|
| files | Array | An array of file paths to inspect |
Example
> const commonDir = require('common-dir')
> files = [
'/Users/75lb/one/package.json',
'/Users/75lb/one/test',
'/Users/75lb/two/test/main.js'
]
> commonDir(files)
'/Users/75lb/'© 2014-21 Lloyd Brookes 75pound@gmail.com. Documented by jsdoc-to-markdown.