commondir
compute the closest common parent for file paths
Last updated 10 years ago by substack .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm 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 (10 years ago)

5 Versions

  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
  • 0.0.2                                ...           10 years ago
  • 0.0.1                                ...           13 years ago
  • 0.0.0                                ...           13 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)

Copyright 2013 - present © cnpmjs.org | Home |