{"_id":"common-ancestor-path","_rev":"1250590","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":"i@izs.me"}],"time":{"modified":"2026-08-21T21:01:29.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":{"integrity":"sha512-dnN3ibLeoRf2HNC+OlCiNc5d2zxbLJXOtiZUudNFSXZrNSydxcCsSpRzXwfu7BBWCIfHPw+xTayeBvJCP/D8Ng==","shasum":"f1d361aea9236aad5b92a0ff5b9df1422dd360ff","tarball":"http://registry-npm.ywwl.com/common-ancestor-path/download/common-ancestor-path-2.0.0.tgz","fileCount":13,"unpackedSize":9161,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIETfrJss7EycLgE3XzyOCCIijLtROdagF8BZ4NBY4FtoAiB9PjdWOCZ1VddpadGLyTydXoW7PV8oxkZ8SE56dhKXCQ=="}],"size":3045,"noattachment":false,"key":"/common-ancestor-path/-/common-ancestor-path-2.0.0.tgz"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/common-ancestor-path_2.0.0_1764047214737_0.46639421557017613"},"_hasShrinkwrap":false,"publish_time":1764047214935,"_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":{"integrity":"sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==","shasum":"4f7d2d1394d91b7abdf51871c62f71eadb0182a7","tarball":"http://registry-npm.ywwl.com/common-ancestor-path/download/common-ancestor-path-1.0.1.tgz","fileCount":4,"unpackedSize":2574,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeyz48CRA9TVsSAnZWagAAVJ0P/jhrixgZm6kFdLInL2C6\nYp7KQRvlDpCYvovLu4tByk77+jxaMEWWpH8+aCSJBObcottf5TemvaEnwEor\npwVqdM1G7hxB5+POz8VdbacVnCIDYjWa9sEGIn36ZYWz/jnKyeYnoB4s2DJG\nFpASqkzzFl1l/8BEMPcxf54inorRz9YC67uSf6Ijw6RYPy7nXOGR24bJ+5xK\n5BsiaSUf32ppzQcmL6zVMu+5pBcMzfXfHYBqe7Sf+OXZ+tE2ge5M6RmF0iwM\nJUWk3+A2rHTEPYUHdZoSXOj5njKQHKtvL16qirANidE8gh4ex8AQv/VlaPgx\nJZqfjujC9d39KVpwEsS2lKhCsoF5HtdlKToJo1qpT3T/mKLD6zMo5fTp4DFM\nPD8ruG8cngI1XaquYL/Sc8HN69ziqQKxbJKTkMq/QIG1QhmsjTorr/YmBbF0\nE0FYXr3zMzt70JukjvAW8lrf+XG/P1gXoypA2KN6eWvCNM67/G+1oKGTTy8R\niJFk5lJQSt5EW3RiDBKUJjPuCZgkAvHH57CaQZVj7blOGuzlwUSfmBlmxeWc\nqw93IRyLQXpkFoCksbAaJXTEbW0530a7+Dh+IjQS/OreueuOhLN5L4L3rep9\n041nr26pPsZ3QaULV/0JXaNk3ciJxyEZpMLsDhYbqnIVy+WlzuNzyGs628OP\n7I3c\r\n=2RKF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDicxuhQcaPCNyeV0q68UiG+dAkPsSevtvoyfml3Fx+gAiAc9XeSHCU5sRjtoCvcaAcO7tHtTKzEtexiNp8m41QCoQ=="}],"size":1554,"noattachment":false,"key":"/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"_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":{"integrity":"sha512-E2lb9X0KxPLX48ZY+bqErM7H71UnR8f+4eTTbvTlktfp5XKlkVIjfgX2hAlMjCJFPT6txGGsYpJoEa4Kk24hNg==","shasum":"c588649948673929b3252abecb4d4c58dd668f44","tarball":"http://registry-npm.ywwl.com/common-ancestor-path/download/common-ancestor-path-1.0.0.tgz","fileCount":3,"unpackedSize":2098,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeyz4KCRA9TVsSAnZWagAAfE0P/i/3UnI1g/gLJWKSBpuW\n1isJpotsCe+5H9uCocUBdb2JxgdAkWI4SKigUzoAejhljVoA0RcenAmIdbyx\nZno/PsOfQ59O3mxgNeBAQ5fueFrrmYtshQaF9cJoUfX0uiBXZeYmBal5rlnM\nxrFu+c674gks0duAE5Y4VIZy4NH0XH08lcXUOvxKv4hdrTtfLGEl5rC4+E3s\nsvXm582uInM+4zrX1rLVTsDMIOmpaZTAZIMuyFaso3a0WbPC4WClPNRWWfPO\nuh2P7p3nV3RzAoVC6KchL6Ty2rM/xcXl7v0Tx4ki/vrI6y5QQm19+Zk7R+k6\nJwhXI88y09tUU4CgErbNgBTFpTS01uRMfpSZLgmHVlK1lz/j0Pn2kDttlCOA\ndoydGD0qAl4QredEu29jPwYa9Mc5Qwb8fvt6UfeDC+hxfVn2jtQJRpAflsa4\n04vn0vQfkz0aaVMjcNmmFeMwsFOoeVupbBA/qsQlCUk1dCOhsvvVXmxQjcug\nwbpGtq9oF55+3d0KS8zie2nFP1pTwogqFId4AAkt8Vot+ZGIO0NeKbWdLlgr\nRGbITezm7IVepr83AOYqE/oZt1Ie2a23Wp7g6+LNFNYUACVCMHPGwStWZuvG\nUOOigddPmTUARC7X0BqoqMhaiU22LUZPao6AJsEqN/0Ri5TSHDX7EIKS6wcO\n59rs\r\n=38Rf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDW+juldPuIw67dUvytyBJcDQWismI/0466hRJa+YG0AAIgXdBz6boUPgxRpy+Yh+j7n9Bo7hr1iF366iBMfItasZ4="}],"size":1287,"noattachment":false,"key":"/common-ancestor-path/-/common-ancestor-path-1.0.0.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"_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"}