Comparing version 1.0.6 to 1.1.0
46
index.js
const posix = makePath(false) | ||
const win32 = makePath(true) | ||
posix.win32 = win32 | ||
win32.posix = posix | ||
posix.win32 = win32.win32 = win32 | ||
posix.posix = win32.posix = posix | ||
@@ -12,9 +12,6 @@ module.exports = process.platform === 'win32' ? win32 : posix | ||
path.posix = path | ||
path.win32 = path | ||
const sep = path.sep = windows ? '\\' : '/' | ||
if (windows) { | ||
path.isAbsolute = function isAbsolute (p) { | ||
path.isAbsolute = windows | ||
? function isAbsolute (p) { | ||
if (p.length === 0) return false | ||
@@ -25,4 +22,8 @@ return (p[0] === '\\' || p[0] === '/') || | ||
} | ||
: function isAbsolute (p) { | ||
return p.length > 0 && p[0] === '/' | ||
} | ||
path.root = function root (p) { | ||
path.root = windows | ||
? function root (p) { | ||
if (p.length === 0) return '' | ||
@@ -38,11 +39,28 @@ | ||
} | ||
} else { | ||
path.isAbsolute = function isAbsolute (p) { | ||
return p.length > 0 && p[0] === '/' | ||
: function root (p) { | ||
return path.isAbsolute(p) ? '/' : '' | ||
} | ||
path.root = function root (p) { | ||
return path.isAbsolute(p) ? '/' : '' | ||
path.toNamespacedPath = windows | ||
? function toNamespacedPath (p) { | ||
if (p.length === 0) return '' | ||
const r = path.resolve(p) | ||
if (r.length <= 2) return p | ||
if (r[0] === '\\') { | ||
if (r[1] === '\\') { | ||
if (r[2] !== '?' && r[2] !== '.') { | ||
return '\\\\?\\UNC\\' + r.slice(2) | ||
} | ||
} | ||
} else if (r[1] === ':' && (r[2] === '\\' || r[2] === '/')) { | ||
return '\\\\?\\' + r | ||
} | ||
return p | ||
} | ||
} | ||
: function toNamespacedPath (p) { | ||
return p | ||
} | ||
@@ -49,0 +67,0 @@ path.basename = function basename (p) { |
{ | ||
"name": "bare-path", | ||
"version": "1.0.6", | ||
"version": "1.1.0", | ||
"description": "Path manipulation library for JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
15712
121