get-source
Advanced tools
Comparing version 1.0.32 to 1.0.33
@@ -15,3 +15,3 @@ "use strict"; | ||
const a_endsWithSlash = (a[a.length - 1] === '/'), | ||
b_startsWithSlash = (b[0] === '/') | ||
b_startsWithSlash = (b[0] === '/') | ||
@@ -23,37 +23,37 @@ return a + ((a_endsWithSlash || b_startsWithSlash) ? '' : '/') + | ||
if (path.isAbsolute (x)) { | ||
return path.normalize (x) } | ||
if (path.isAbsolute (x)) { | ||
return path.normalize (x) } | ||
return path.normalize (path.concat (cwd, x)) | ||
return path.normalize (path.concat (cwd, x)) | ||
}, | ||
normalize (x) { | ||
normalize (x) { | ||
let output = [], | ||
skip = 0 | ||
let output = [], | ||
skip = 0 | ||
x.split ('/').reverse ().filter (x => x !== '.').forEach (x => { | ||
x.split ('/').reverse ().filter (x => x !== '.').forEach (x => { | ||
if (x === '..') { skip++ } | ||
else if (skip === 0) { output.push (x) } | ||
else { skip-- } | ||
}) | ||
if (x === '..') { skip++ } | ||
else if (skip === 0) { output.push (x) } | ||
else { skip-- } | ||
}) | ||
const result = output.reverse ().join ('/') | ||
const result = output.reverse ().join ('/') | ||
return ((isBrowser && (result[0] === '/')) ? window.location.origin : '') + result | ||
}, | ||
return ((isBrowser && (result[0] === '/')) ? window.location.origin : '') + result | ||
}, | ||
isData: x => x.indexOf ('data:') === 0, | ||
isData: x => x.indexOf ('data:') === 0, | ||
isAbsolute: x => (x[0] === '/') || /^[^\/]*:/.test (x), | ||
isAbsolute: x => (x[0] === '/') || /^[^\/]*:/.test (x), | ||
relativeToFile (a, b) { | ||
return (path.isData (a) || path.isAbsolute (b)) ? | ||
path.normalize (b) : | ||
path.normalize (path.concat (a.split ('/').slice (0, -1).join ('/'), b)) | ||
} | ||
relativeToFile (a, b) { | ||
return (path.isData (a) || path.isAbsolute (b)) ? | ||
path.normalize (b) : | ||
path.normalize (path.concat (a.split ('/').slice (0, -1).join ('/'), b)) | ||
} | ||
} | ||
/* ------------------------------------------------------------------------ */ |
{ | ||
"name": "get-source", | ||
"version": "1.0.32", | ||
"version": "1.0.33", | ||
"description": "Platform-agnostic source code inspection, with sourcemaps support", | ||
@@ -5,0 +5,0 @@ "main": "get-source", |
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
26291