3.0.1 • Published 3 years ago

common-dir v3.0.1

Weekly downloads
142,652
License
MIT
Repository
github
Last release
3 years ago

view on npm npm module downloads Gihub repo dependents Gihub package dependents Build Status js-standard-style

common-dir

commonDir(files) ⇒ 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/'

ParamTypeDescription
filesArrayAn 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.