path-normalize
Advanced tools
Comparing version 4.0.9 to 4.0.10
@@ -28,6 +28,12 @@ "use strict"; | ||
var dots = 0; | ||
var code; | ||
var code; // eslint-disable-next-line fp/no-loops | ||
for (var i = 0; i <= path.length; ++i) { | ||
if (i < path.length) code = path.charCodeAt(i);else if (code === SLASH) break;else code = SLASH; | ||
if (i < path.length) { | ||
code = path.charCodeAt(i); | ||
} else if (code === SLASH) { | ||
break; | ||
} else { | ||
code = SLASH; | ||
} | ||
@@ -64,3 +70,8 @@ if (code === SLASH) { | ||
if (allowAboveRoot) { | ||
if (res.length > 0) res += '/..';else res = '..'; | ||
if (res.length > 0) { | ||
res += '/..'; | ||
} else { | ||
res = '..'; | ||
} | ||
lastSegmentLength = 2; | ||
@@ -101,3 +112,7 @@ } | ||
var path = p; | ||
if (path.length === 0) return '.'; | ||
if (path.length === 0) { | ||
return '.'; | ||
} | ||
var isAbsolute = path.charCodeAt(0) === SLASH; | ||
@@ -107,5 +122,15 @@ var trailingSeparator = path.charCodeAt(path.length - 1) === SLASH; | ||
path = posixNormalize(path, !isAbsolute); | ||
if (path.length === 0 && !isAbsolute) path = '.'; | ||
if (path.length > 0 && trailingSeparator) path += '/'; | ||
if (isAbsolute) return '/' + path; | ||
if (path.length === 0 && !isAbsolute) { | ||
path = '.'; | ||
} | ||
if (path.length > 0 && trailingSeparator) { | ||
path += '/'; | ||
} | ||
if (isAbsolute) { | ||
return '/' + path; | ||
} | ||
return path; | ||
@@ -112,0 +137,0 @@ }; |
{ | ||
"name": "path-normalize", | ||
"description": "Zero-dependency browser-oriented path.normalize", | ||
"version": "4.0.9", | ||
"version": "4.0.10", | ||
"author": { | ||
@@ -28,3 +28,3 @@ "email": "zac@zacanger.com", | ||
"test": "run-s -s test:lint test:tape", | ||
"test:lint": "standard src", | ||
"test:lint": "eslint -c .eslintrc.json src", | ||
"test:tape": "babel-tape-runner src/test.js" | ||
@@ -50,6 +50,8 @@ }, | ||
"babel-tape-runner": "3.0.0", | ||
"eslint": "6.8.0", | ||
"eslint-plugin-zacanger": "1.1.2", | ||
"npm-run-all": "4.1.5", | ||
"nyc": "15.0.0", | ||
"sortpack": "2.1.1", | ||
"standard": "14.3.1", | ||
"prettier": "1.19.1", | ||
"sortpack": "2.1.2", | ||
"tape": "4.13.2" | ||
@@ -56,0 +58,0 @@ }, |
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
14959
116
12