diff options
Diffstat (limited to 'node_modules/common-path-prefix')
-rw-r--r-- | node_modules/common-path-prefix/LICENSE | 14 | ||||
-rw-r--r-- | node_modules/common-path-prefix/README.md | 53 | ||||
-rw-r--r-- | node_modules/common-path-prefix/index.js | 46 | ||||
-rw-r--r-- | node_modules/common-path-prefix/package.json | 29 |
4 files changed, 0 insertions, 142 deletions
diff --git a/node_modules/common-path-prefix/LICENSE b/node_modules/common-path-prefix/LICENSE deleted file mode 100644 index ee1e36789..000000000 --- a/node_modules/common-path-prefix/LICENSE +++ /dev/null @@ -1,14 +0,0 @@ -ISC License (ISC) -Copyright (c) 2016, Mark Wubben - -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. diff --git a/node_modules/common-path-prefix/README.md b/node_modules/common-path-prefix/README.md deleted file mode 100644 index 451794bbe..000000000 --- a/node_modules/common-path-prefix/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# common-path-prefix - -Computes the longest prefix string that is common to each path, excluding the -base component. Tested with Node 0.10 and above. - -## Installation - -``` -npm install --save common-path-prefix -``` - -## Usage - -The module has one default export, the `commonPathPrefix` function: - -```js -var commonPathPrefix = require('common-path-prefix') -``` - -Call `commonPathPrefix()` with an array of paths (strings) and an optional -separator character: - -```js -var paths = ['templates/main.handlebars', 'templates/_partial.handlebars'] - -commonPathPrefix(paths, '/') // returns 'templates/' -``` - -If the separator is not provided the first `/` or `\` found in the first path -string is used. This means the module works correctly no matter the platform: - -```js -commonPathPrefix(['templates/main.handlebars', 'templates/_partial.handlebars']) // returns 'templates/' -commonPathPrefix(['templates\\main.handlebars', 'templates\\_partial.handlebars']) // returns 'templates\\' -``` - -You can provide any separator, for example: - -```js -commonPathPrefix(['foo$bar', 'foo$baz'], '$') // returns 'foo$'' -``` - -An empty string is returned if no common prefix exists: - -```js -commonPathPrefix(['foo/bar', 'baz/qux']) // returns '' -``` - -Note that the following *does* have a common prefix: - -```js -commonPathPrefix(['/foo/bar', '/baz/qux']) // returns '/' -``` diff --git a/node_modules/common-path-prefix/index.js b/node_modules/common-path-prefix/index.js deleted file mode 100644 index c62acea9c..000000000 --- a/node_modules/common-path-prefix/index.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict' - -function getDirectoryComponents (path, sep) { - var components = path.split(sep) - - // Remove any trailing separators and the base component. - var last = '' - while (last === '') { - last = components.pop() - } - - return components -} - -module.exports = function commonPathPrefix (paths, sep) { - if (!sep) { - var m = /(\/|\\)/.exec(paths[0]) - // The first path did not contain any directory components. Bail now. - if (!m) return '' - sep = m[0] - } - - // Object to hold prefix strings formed of the directory components of each - // path. The value for each prefix string is the number of times that prefix - // occurred in the `paths` array. - var prefixes = Object.create(null) - for (var i = 0; i < paths.length; i++) { - var dirComponents = getDirectoryComponents(paths[i], sep) - var prefix = '' - for (var j = 0; j < dirComponents.length; j++) { - prefix += dirComponents[j] + sep - prefixes[prefix] = (prefixes[prefix] || 0) + 1 - } - } - - // Find the prefixes that occurred for each path and sort them by length - // (longest first). - var common = Object.keys(prefixes).filter(function (prefix) { - return prefixes[prefix] === paths.length - }).sort(function (a, b) { - return b.length - a.length - }) - - // Return the longest common path prefix, or the empty string. - return common[0] || '' -} diff --git a/node_modules/common-path-prefix/package.json b/node_modules/common-path-prefix/package.json deleted file mode 100644 index 9712f82c6..000000000 --- a/node_modules/common-path-prefix/package.json +++ /dev/null @@ -1,29 +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": "Mark Wubben (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" - } -} |