{"_id":"common-path-prefix","_rev":"3151188","name":"common-path-prefix","description":"Computes the longest prefix string that is common to each path, excluding the base component","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"novemberborn","email":"mark@novemberborn.net"}],"time":{"modified":"2023-11-28T02:15:54.000Z","created":"2016-01-11T16:43:02.585Z","3.0.0":"2019-11-03T17:04:02.458Z","2.0.0":"2019-08-28T08:17:27.273Z","1.0.0":"2016-01-11T16:43:02.585Z"},"users":{"novemberborn":true,"kael":true},"author":{"name":"Mark Wubben","url":"https://novemberborn.net/"},"repository":{"type":"git","url":"git+https://github.com/novemberborn/common-path-prefix.git"},"versions":{"3.0.0":{"name":"common-path-prefix","version":"3.0.0","description":"Computes the longest prefix string that is common to each path, excluding the base component","main":"index.js","scripts":{"test":"standard && nyc ava"},"repository":{"type":"git","url":"git+https://github.com/novemberborn/common-path-prefix.git"},"author":{"name":"Mark Wubben","url":"https://novemberborn.net/"},"license":"ISC","bugs":{"url":"https://github.com/novemberborn/common-path-prefix/issues"},"homepage":"https://github.com/novemberborn/common-path-prefix#readme","keywords":["common","path","directory","dir","file","root","typescript","common prefix","common path","common path start","common root"],"devDependencies":{"ava":"^2.3.0","nyc":"^14.1.1","standard":"^14.0.2"},"gitHead":"ff573979a038f0946ce27498fd1e570489b8f27d","_id":"common-path-prefix@3.0.0","_nodeVersion":"12.13.0","_npmVersion":"6.12.1","dist":{"shasum":"7d007a7e07c58c4b4d5f433131a19141b29f11e0","size":1964,"noattachment":false,"key":"/common-path-prefix/-/common-path-prefix-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/common-path-prefix/download/common-path-prefix-3.0.0.tgz"},"maintainers":[{"name":"novemberborn","email":"mark@novemberborn.net"}],"_npmUser":{"name":"novemberborn","email":"mark@novemberborn.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/common-path-prefix_3.0.0_1572800642368_0.8156717019850825"},"_hasShrinkwrap":false,"publish_time":1572800642458,"_cnpm_publish_time":1572800642458,"_cnpmcore_publish_time":"2021-12-16T15:31:50.280Z"},"2.0.0":{"name":"common-path-prefix","version":"2.0.0","description":"Computes the longest prefix string that is common to each path, excluding the base component","main":"index.js","scripts":{"test":"standard && nyc ava"},"repository":{"type":"git","url":"git+https://github.com/novemberborn/common-path-prefix.git"},"author":{"name":"Mark Wubben","url":"https://novemberborn.net/"},"license":"ISC","bugs":{"url":"https://github.com/novemberborn/common-path-prefix/issues"},"homepage":"https://github.com/novemberborn/common-path-prefix#readme","keywords":["common","path","directory","dir","file","root","typescript","common prefix","common path","common path start","common root"],"devDependencies":{"ava":"^2.3.0","nyc":"^14.1.1","standard":"^14.0.2"},"gitHead":"9c3b64c8f220c4c58b54d28e0c13c8eea1ec0699","_id":"common-path-prefix@2.0.0","_nodeVersion":"10.16.3","_npmVersion":"6.11.2","dist":{"shasum":"25b0265f318bf093a6ec630813aac97b29dea230","size":1885,"noattachment":false,"key":"/common-path-prefix/-/common-path-prefix-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/common-path-prefix/download/common-path-prefix-2.0.0.tgz"},"maintainers":[{"name":"novemberborn","email":"mark@novemberborn.net"}],"_npmUser":{"name":"novemberborn","email":"mark@novemberborn.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/common-path-prefix_2.0.0_1566980247159_0.6050454893692394"},"_hasShrinkwrap":false,"publish_time":1566980247273,"_cnpm_publish_time":1566980247273},"1.0.0":{"name":"common-path-prefix","version":"1.0.0","description":"Computes the longest prefix string that is common to each path, excluding the base component","main":"index.js","files":["index.js"],"scripts":{"coverage":"nyc npm test","test":"ava","posttest":"standard"},"repository":{"type":"git","url":"git+https://github.com/novemberborn/common-path-prefix.git"},"author":{"name":"Mark Wubben","url":"https://novemberborn.net/"},"license":"ISC","bugs":{"url":"https://github.com/novemberborn/common-path-prefix/issues"},"homepage":"https://github.com/novemberborn/common-path-prefix#readme","devDependencies":{"ava":"^0.9.1","nyc":"^5.3.0","standard":"^5.4.1"},"gitHead":"164356169afc042f691178b2731bebbbfe85499d","_id":"common-path-prefix@1.0.0","_shasum":"cd52f6f0712e0baab97d6f9732874f22f47752c0","_from":".","_npmVersion":"3.5.3","_nodeVersion":"5.4.0","_npmUser":{"name":"novemberborn","email":"mark@novemberborn.net"},"dist":{"shasum":"cd52f6f0712e0baab97d6f9732874f22f47752c0","size":2052,"noattachment":false,"key":"/common-path-prefix/-/common-path-prefix-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/common-path-prefix/download/common-path-prefix-1.0.0.tgz"},"maintainers":[{"name":"novemberborn","email":"mark@novemberborn.net"}],"directories":{},"publish_time":1452530582585,"_cnpm_publish_time":1452530582585,"_hasShrinkwrap":false}},"readme":"# common-path-prefix\n\nComputes the longest prefix string that is common to each path, excluding the base component. Tested with Node.js 8 and above.\n\n## Installation\n\n```console\nnpm install common-path-prefix\n```\n\n## Usage\n\nThe module has one default export, the `commonPathPrefix` function:\n\n```js\nconst commonPathPrefix = require('common-path-prefix')\n```\n\nCall `commonPathPrefix()` with an array of paths (strings) and an optional separator character:\n\n```js\nconst paths = ['templates/main.handlebars', 'templates/_partial.handlebars']\n\ncommonPathPrefix(paths, '/') // returns 'templates/'\n```\n\nIf the separator is not provided the first `/` or `\\` found in any of the paths is used. Otherwise the platform-default value is used:\n\n```js\ncommonPathPrefix(['templates/main.handlebars', 'templates/_partial.handlebars']) // returns 'templates/'\ncommonPathPrefix(['templates\\\\main.handlebars', 'templates\\\\_partial.handlebars']) // returns 'templates\\\\'\n```\n\nYou can provide any separator, for example:\n\n```js\ncommonPathPrefix(['foo$bar', 'foo$baz'], '$') // returns 'foo$''\n```\n\nAn empty string is returned if no common prefix exists:\n\n```js\ncommonPathPrefix(['foo/bar', 'baz/qux']) // returns ''\ncommonPathPrefix(['foo/bar']) // returns ''\n```\n\nNote that the following *does* have a common prefix:\n\n```js\ncommonPathPrefix(['/foo/bar', '/baz/qux']) // returns '/'\n```\n","_attachments":{},"homepage":"https://github.com/novemberborn/common-path-prefix#readme","bugs":{"url":"https://github.com/novemberborn/common-path-prefix/issues"},"license":"ISC"}