INNER CODE UNIT · JavaScript
normalizeStringPosix
mx-space/core · apps/admin/polyfills/packages/path/index.js:12
function normalizeStringPosix(path, allowAboveRoot) {
var res = ''
var lastSegmentLength = 0
var lastSlash = -1
var dots = 0
var code
for (var i = 0; i <= path.length; ++i) {
if (i < path.length) code = path.charCodeAt(i)
else if (code === 47 /*/*/) break
else code = 47 /*/*/
if (code === 47 /*/*/) {
if (lastSlash === i - 1 || dots === 1) {
// NOOP
} else if (lastSlash !== i - 1 && dots === 2) {
if (
res.length < 2 ||
lastSegmentLength !== 2 ||
res.charCodeAt(res.length - 1) !== 46 /*.*/ ||