Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/common-ancestor-path/README.md')
-rw-r--r--node_modules/common-ancestor-path/README.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/node_modules/common-ancestor-path/README.md b/node_modules/common-ancestor-path/README.md
new file mode 100644
index 000000000..2e8764373
--- /dev/null
+++ b/node_modules/common-ancestor-path/README.md
@@ -0,0 +1,28 @@
+# common-ancestor-path
+
+Find the common ancestor of 2 or more paths on Windows or Unix
+
+## USAGE
+
+Give it two or more path strings, and it'll do the thing.
+
+```js
+const ancestor = require('common-ancestor-path')
+
+// output /a/b
+console.log(ancestor('/a/b/c/d', '/a/b/x/y/z', '/a/b/c/i/j/k'))
+
+// normalizes separators, but NOT cases, since it matters sometimes
+console.log(ancestor('C:\\a\\b\\c', 'C:\\a\\b\\x'))
+
+// no common ancestor on different windows drive letters
+// so, this returns null
+console.log(ancestor('c:\\a\\b\\c', 'd:\\d\\e\\f'))
+```
+
+## API
+
+`commonAncestorPath(...paths)`
+
+Returns the nearest (deepest) common ancestor path, or `null` if on
+different roots on Windows.