{"_id":"common-ancestor-path","_rev":"4130884","name":"common-ancestor-path","description":"Find the common ancestor of 2 or more paths on Windows or Unix","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"isaacs","email":""}],"time":{"modified":"2026-03-01T18:33:05.000Z","created":"2020-05-25T03:39:53.979Z","2.0.0":"2025-11-25T05:06:54.935Z","1.0.1":"2020-05-25T03:40:43.934Z","1.0.0":"2020-05-25T03:39:53.979Z"},"users":{},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"repository":{"type":"git","url":"git+ssh://git@github.com/isaacs/common-ancestor-path.git"},"versions":{"2.0.0":{"name":"common-ancestor-path","version":"2.0.0","description":"Find the common ancestor of 2 or more paths on Windows or Unix","repository":{"type":"git","url":"git+ssh://git@github.com/isaacs/common-ancestor-path.git"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"license":"BlueOak-1.0.0","scripts":{"preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","prepare":"tshy","pretest":"npm run prepare","presnap":"npm run prepare","test":"tap","snap":"tap","format":"prettier --write . --log-level warn --cache","typedoc":"typedoc"},"devDependencies":{"@types/node":"^24.10.1","prettier":"^3.6.2","require-inject":"^1.4.4","tap":"^21.1.6","tshy":"^3.1.0","typedoc":"^0.28.14"},"type":"module","tshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts"}},"exports":{"./package.json":"./package.json",".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}}},"main":"./dist/commonjs/index.js","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">= 18"},"gitHead":"a25a6001e0422a97fb34afaab01d8f20f6536566","_id":"common-ancestor-path@2.0.0","bugs":{"url":"https://github.com/isaacs/common-ancestor-path/issues"},"homepage":"https://github.com/isaacs/common-ancestor-path#readme","_nodeVersion":"24.4.1","_npmVersion":"11.6.3","dist":{"shasum":"f1d361aea9236aad5b92a0ff5b9df1422dd360ff","size":3045,"noattachment":false,"key":"/common-ancestor-path/-/common-ancestor-path-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/common-ancestor-path/download/common-ancestor-path-2.0.0.tgz"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"maintainers":[{"name":"isaacs","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/common-ancestor-path_2.0.0_1764047214737_0.46639421557017613"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-11-25T05:06:54.935Z","publish_time":1764047214935,"_source_registry_name":"default","_cnpm_publish_time":1764047214935},"1.0.1":{"name":"common-ancestor-path","version":"1.0.1","description":"Find the common ancestor of 2 or more paths on Windows or Unix","repository":{"type":"git","url":"git+https://github.com/isaacs/common-ancestor-path.git"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"license":"ISC","scripts":{"test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"tap":{"check-coverage":true},"devDependencies":{"require-inject":"^1.4.4","tap":"^14.10.7"},"gitHead":"0bf875bd22a01c40364a8f9fb185c78cf27d0fb0","bugs":{"url":"https://github.com/isaacs/common-ancestor-path/issues"},"homepage":"https://github.com/isaacs/common-ancestor-path#readme","_id":"common-ancestor-path@1.0.1","_nodeVersion":"14.2.0","_npmVersion":"6.14.4","dist":{"shasum":"4f7d2d1394d91b7abdf51871c62f71eadb0182a7","size":1554,"noattachment":false,"key":"/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/common-ancestor-path/download/common-ancestor-path-1.0.1.tgz"},"maintainers":[{"name":"isaacs","email":""}],"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/common-ancestor-path_1.0.1_1590378043809_0.2920039523218916"},"_hasShrinkwrap":false,"publish_time":1590378043934,"_cnpm_publish_time":1590378043934},"1.0.0":{"name":"common-ancestor-path","version":"1.0.0","description":"Find the common ancestor of 2 or more paths on Windows or Unix","repository":{"type":"git","url":"git+https://github.com/isaacs/common-ancestor-path.git"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"license":"ISC","scripts":{"test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"tap":{"check-coverage":true},"devDependencies":{"require-inject":"^1.4.4","tap":"^14.10.7"},"gitHead":"ab5ca4e6d7c3bb9873cdeb6c5ad1634b5333dc79","bugs":{"url":"https://github.com/isaacs/common-ancestor-path/issues"},"homepage":"https://github.com/isaacs/common-ancestor-path#readme","_id":"common-ancestor-path@1.0.0","_nodeVersion":"14.2.0","_npmVersion":"6.14.4","dist":{"shasum":"c588649948673929b3252abecb4d4c58dd668f44","size":1287,"noattachment":false,"key":"/common-ancestor-path/-/common-ancestor-path-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/common-ancestor-path/download/common-ancestor-path-1.0.0.tgz"},"maintainers":[{"name":"isaacs","email":""}],"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/common-ancestor-path_1.0.0_1590377993830_0.34272591981278255"},"_hasShrinkwrap":false,"publish_time":1590377993979,"_cnpm_publish_time":1590377993979}},"readme":"# common-ancestor-path\n\nFind the common ancestor of 2 or more paths on Windows or Unix\n\n## USAGE\n\nGive it two or more path strings, and it'll do the thing.\n\n```ts\nimport { commonAncestorPath } from 'common-ancestor-path'\n// or:\n// const { commonAncestorPath } = require('common-ancestor-path')\n\n// output /a/b\nconsole.log(commonAncestorPath('/a/b/c/d', '/a/b/x/y/z', '/a/b/c/i/j/k'))\n\n// normalizes separators, but NOT cases, since it matters sometimes\nconsole.log(commonAncestorPath('C:\\\\a\\\\b\\\\c', 'C:\\\\a\\\\b\\\\x'))\n\n// no common ancestor on different windows drive letters\n// so, this returns null\nconsole.log(commonAncestorPath('c:\\\\a\\\\b\\\\c', 'd:\\\\d\\\\e\\\\f'))\n```\n\n## API\n\n`commonAncestorPath(...paths)`\n\nReturns the nearest (deepest) common ancestor path, or `null` if on\ndifferent roots on Windows.\n","_attachments":{},"homepage":"https://github.com/isaacs/common-ancestor-path#readme","bugs":{"url":"https://github.com/isaacs/common-ancestor-path/issues"},"license":"BlueOak-1.0.0"}