diff options
author | isaacs <i@izs.me> | 2013-12-16 16:23:13 -0800 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-12-16 23:09:16 -0800 |
commit | 97738994e0bc2f3255659ca8f27e43a90aa0a24e (patch) | |
tree | 51bc3a3a928ddcba4944b8294656158d120d3d75 /deps/npm/node_modules/path-is-inside | |
parent | 39e2426b209799d5deaa29d2401dd98f060babda (diff) | |
download | android-node-v8-97738994e0bc2f3255659ca8f27e43a90aa0a24e.tar.gz android-node-v8-97738994e0bc2f3255659ca8f27e43a90aa0a24e.tar.bz2 android-node-v8-97738994e0bc2f3255659ca8f27e43a90aa0a24e.zip |
npm: Upgrade to 1.3.19
Diffstat (limited to 'deps/npm/node_modules/path-is-inside')
-rw-r--r-- | deps/npm/node_modules/path-is-inside/LICENSE.txt | 14 | ||||
-rw-r--r-- | deps/npm/node_modules/path-is-inside/README.md | 35 | ||||
-rw-r--r-- | deps/npm/node_modules/path-is-inside/lib/path-is-inside.js | 24 | ||||
-rw-r--r-- | deps/npm/node_modules/path-is-inside/package.json | 39 |
4 files changed, 112 insertions, 0 deletions
diff --git a/deps/npm/node_modules/path-is-inside/LICENSE.txt b/deps/npm/node_modules/path-is-inside/LICENSE.txt new file mode 100644 index 0000000000..db2caa13fb --- /dev/null +++ b/deps/npm/node_modules/path-is-inside/LICENSE.txt @@ -0,0 +1,14 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2013 Domenic Denicola <domenic@domenicdenicola.com> + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + diff --git a/deps/npm/node_modules/path-is-inside/README.md b/deps/npm/node_modules/path-is-inside/README.md new file mode 100644 index 0000000000..d42e6aa736 --- /dev/null +++ b/deps/npm/node_modules/path-is-inside/README.md @@ -0,0 +1,35 @@ +# Is This Path Inside This Other Path? + +It turns out this question isn't trivial to answer using Node's built-in path APIs. A naive `indexOf`-based solution will fail sometimes on Windows, which is case-insensitive (see e.g. [isaacs/npm#4214][]). You might then think to be clever with `path.resolve`, but you have to be careful to account for situations whether the paths have different drive letters, or else you'll cause bugs like [isaacs/npm#4313][]. And let's not even get started on trailing slashes. + +The **path-is-inside** package will give you a robust, cross-platform way of detecting whether a given path is inside another path. + +## Usage + +Pretty simple. First the path being tested; then the potential parent. Like so: + +```js +var pathIsInside = require("path-is-inside"); + +pathIsInside("/x/y/z", "/x/y") // true +pathIsInside("/x/y", "/x/y/z") // false +``` + +## OS-Specific Behavior + +Like Node's built-in path module, path-is-inside treats all file paths on Windows as case-insensitive, whereas it treats all file paths on *-nix operating systems as case-sensitive. Keep this in mind especially when working on a Mac, where, despite Node's defaults, the OS usually treats paths case-insensitively. + +In practice, this means: + +```js +// On Windows + +pathIsInside("C:\\X\\Y\\Z", "C:\\x\\y") // true + +// On *-nix, including Mac OS X + +pathIsInside("/X/Y/Z", "/x/y") // false +``` + +[isaacs/npm#4214]: https://github.com/isaacs/npm/pull/4214 +[isaacs/npm#4313]: https://github.com/isaacs/npm/issues/4313 diff --git a/deps/npm/node_modules/path-is-inside/lib/path-is-inside.js b/deps/npm/node_modules/path-is-inside/lib/path-is-inside.js new file mode 100644 index 0000000000..5d1160e57d --- /dev/null +++ b/deps/npm/node_modules/path-is-inside/lib/path-is-inside.js @@ -0,0 +1,24 @@ +"use strict"; + +var path = require("path"); + +module.exports = function (thePath, potentialParent) { + // For inside-directory checking, we want to allow trailing slashes, so normalize. + thePath = stripTrailingSep(thePath); + potentialParent = stripTrailingSep(potentialParent); + + // Node treats only Windows as case-insensitive in its path module; we follow those conventions. + if (process.platform === "win32") { + thePath = thePath.toLowerCase(); + potentialParent = potentialParent.toLowerCase(); + } + + return thePath.indexOf(potentialParent) === 0; +}; + +function stripTrailingSep(thePath) { + if (thePath[thePath.length - 1] === path.sep) { + return thePath.slice(0, -1); + } + return thePath; +} diff --git a/deps/npm/node_modules/path-is-inside/package.json b/deps/npm/node_modules/path-is-inside/package.json new file mode 100644 index 0000000000..7df0a695e4 --- /dev/null +++ b/deps/npm/node_modules/path-is-inside/package.json @@ -0,0 +1,39 @@ +{ + "name": "path-is-inside", + "description": "Tests whether one path is inside another path", + "keywords": [ + "path", + "directory", + "folder", + "inside", + "relative" + ], + "version": "1.0.0", + "author": { + "name": "Domenic Denicola", + "email": "domenic@domenicdenicola.com", + "url": "http://domenic.me" + }, + "license": "WTFPL", + "repository": { + "type": "git", + "url": "git://github.com/domenic/path-is-inside.git" + }, + "bugs": { + "url": "http://github.com/domenic/path-is-inside/issues" + }, + "main": "lib/path-is-inside.js", + "scripts": { + "test": "mocha", + "lint": "jshint lib" + }, + "devDependencies": { + "jshint": "~2.3.0", + "mocha": "~1.15.1" + }, + "readme": "# Is This Path Inside This Other Path?\n\nIt turns out this question isn't trivial to answer using Node's built-in path APIs. A naive `indexOf`-based solution will fail sometimes on Windows, which is case-insensitive (see e.g. [isaacs/npm#4214][]). You might then think to be clever with `path.resolve`, but you have to be careful to account for situations whether the paths have different drive letters, or else you'll cause bugs like [isaacs/npm#4313][]. And let's not even get started on trailing slashes.\n\nThe **path-is-inside** package will give you a robust, cross-platform way of detecting whether a given path is inside another path.\n\n## Usage\n\nPretty simple. First the path being tested; then the potential parent. Like so:\n\n```js\nvar pathIsInside = require(\"path-is-inside\");\n\npathIsInside(\"/x/y/z\", \"/x/y\") // true\npathIsInside(\"/x/y\", \"/x/y/z\") // false\n```\n\n## OS-Specific Behavior\n\nLike Node's built-in path module, path-is-inside treats all file paths on Windows as case-insensitive, whereas it treats all file paths on *-nix operating systems as case-sensitive. Keep this in mind especially when working on a Mac, where, despite Node's defaults, the OS usually treats paths case-insensitively.\n\nIn practice, this means:\n\n```js\n// On Windows\n\npathIsInside(\"C:\\\\X\\\\Y\\\\Z\", \"C:\\\\x\\\\y\") // true\n\n// On *-nix, including Mac OS X\n\npathIsInside(\"/X/Y/Z\", \"/x/y\") // false\n```\n\n[isaacs/npm#4214]: https://github.com/isaacs/npm/pull/4214\n[isaacs/npm#4313]: https://github.com/isaacs/npm/issues/4313\n", + "readmeFilename": "README.md", + "homepage": "https://github.com/domenic/path-is-inside", + "_id": "path-is-inside@1.0.0", + "_from": "path-is-inside@" +} |