Browse files

path-is-inside@1.0.1

  • Loading branch information...
1 parent a320fe8 commit 9a4b2c4667c2b1e0054e3d5611ab86acb1760834 @domenic domenic committed Feb 28, 2014
View
11 node_modules/path-is-inside/LICENSE.txt
@@ -1,7 +1,13 @@
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+Copyright © 2013–2014 Domenic Denicola <domenic@domenicdenicola.com>
+
+This work is free. You can redistribute it and/or modify it under the
+terms of the Do What The Fuck You Want To Public License, Version 2,
+as published by Sam Hocevar. See below for more details.
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
- Copyright (C) 2013 Domenic Denicola <domenic@domenicdenicola.com>
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
@@ -11,4 +17,3 @@
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
-
View
6 node_modules/path-is-inside/lib/path-is-inside.js
@@ -13,7 +13,11 @@ module.exports = function (thePath, potentialParent) {
potentialParent = potentialParent.toLowerCase();
}
- return thePath.indexOf(potentialParent) === 0;
+ return thePath.lastIndexOf(potentialParent, 0) === 0 &&
+ (
+ thePath[potentialParent.length] === path.sep ||
+ thePath[potentialParent.length] === undefined
+ );
};
function stripTrailingSep(thePath) {
View
10 node_modules/path-is-inside/package.json
@@ -8,7 +8,7 @@
"inside",
"relative"
],
- "version": "1.0.0",
+ "version": "1.0.1",
"author": {
"name": "Domenic Denicola",
"email": "domenic@domenicdenicola.com",
@@ -34,6 +34,10 @@
"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@"
+ "_id": "path-is-inside@1.0.1",
+ "dist": {
+ "shasum": "c5e6c4764c4cd41f2ac839c53be5621d085726b3"
+ },
+ "_from": "path-is-inside@1.0.1",
+ "_resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.1.tgz"
}

0 comments on commit 9a4b2c4

Please sign in to comment.