common-dir
Returns the parent directory common to each path
Last updated 5 years ago by 75lb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install common-dir 
SYNC missed versions from official npm registry.

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/'

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.

Current Tags

  • 3.0.1                                ...           latest (5 years ago)

10 Versions

  • 3.0.1                                ...           5 years ago
  • 3.0.0                                ...           6 years ago
  • 2.0.2                                ...           8 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           10 years ago
  • 0.1.4                                ...           12 years ago
  • 0.1.3                                ...           12 years ago
  • 0.1.2                                ...           12 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (1)
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |