commondir
compute the closest common parent for file paths
Last updated 11 years ago by substack .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install commondir 
SYNC missed versions from official npm registry.

commondir

compute the closest common parent directory among an array of directories

example

var commondir = require('commondir');
var dir = commondir(process.argv.slice(2))
console.log(dir);

output:

$ node dir.js /x/y/z /x/y /x/y/w/q
/x/y
$ node ../baz ../../foo/quux ./bizzy
/foo

methods

var commondir = require('commondir');

commondir(absolutePaths)

Compute the closest common parent directory for an array absolutePaths.

commondir(basedir, relativePaths)

Compute the closest common parent directory for an array relativePaths which will be resolved for each dir in relativePaths according to: path.resolve(basedir, dir).

install

With npm do:

npm install commondir

license

MIT

Current Tags

  • 1.0.1                                ...           latest (11 years ago)

5 Versions

  • 1.0.1                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
  • 0.0.2                                ...           11 years ago
  • 0.0.1                                ...           14 years ago
  • 0.0.0                                ...           15 years ago
Maintainers (1)
Downloads
Today 0
This Week 69
This Month 97
Last Day 11
Last Week 43
Last Month 186
Dependencies (0)
None
Dev Dependencies (1)

Copyright 2013 - present © cnpmjs.org | Home |