is-path-inside
Advanced tools
Comparing version 3.0.2 to 3.0.3
23
index.js
@@ -5,18 +5,9 @@ 'use strict'; | ||
module.exports = (childPath, parentPath) => { | ||
childPath = path.resolve(childPath); | ||
parentPath = path.resolve(parentPath); | ||
if (process.platform === 'win32') { | ||
childPath = childPath.toLowerCase(); | ||
parentPath = parentPath.toLowerCase(); | ||
} | ||
if (childPath === parentPath) { | ||
return false; | ||
} | ||
childPath += path.sep; | ||
parentPath += path.sep; | ||
return childPath.startsWith(parentPath); | ||
const relation = path.relative(parentPath, childPath); | ||
return Boolean( | ||
relation && | ||
relation !== '..' && | ||
!relation.startsWith(`..${path.sep}`) && | ||
relation !== path.resolve(childPath) | ||
); | ||
}; |
{ | ||
"name": "is-path-inside", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Check if a path is inside another path", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1,2 +0,2 @@ | ||
# is-path-inside [![Build Status](https://travis-ci.org/sindresorhus/is-path-inside.svg?branch=master)](https://travis-ci.org/sindresorhus/is-path-inside) | ||
# is-path-inside | ||
@@ -3,0 +3,0 @@ > Check if a path is inside another path |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4121
30