source: trip-planner-front/node_modules/commondir/readme.markdown@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 780 bytes
Line 
1# commondir
2
3compute the closest common parent directory among an array of directories
4
5# example
6
7``` js
8var commondir = require('commondir');
9var dir = commondir(process.argv.slice(2))
10console.log(dir);
11```
12
13output:
14
15```
16$ node dir.js /x/y/z /x/y /x/y/w/q
17/x/y
18$ node ../baz ../../foo/quux ./bizzy
19/foo
20```
21
22# methods
23
24``` js
25var commondir = require('commondir');
26```
27
28## commondir(absolutePaths)
29
30Compute the closest common parent directory for an array `absolutePaths`.
31
32## commondir(basedir, relativePaths)
33
34Compute the closest common parent directory for an array `relativePaths` which
35will be resolved for each `dir` in `relativePaths` according to:
36`path.resolve(basedir, dir)`.
37
38# install
39
40With [npm](https://npmjs.org) do:
41
42```
43npm install commondir
44```
45
46# license
47
48MIT
Note: See TracBrowser for help on using the repository browser.