INNER CODE UNIT · JavaScript
hasRoot
mx-space/core · apps/admin/polyfills/packages/path/index.js:257
var hasRoot = code === 47 /*/*/
var end = -1
var matchedSlash = true
for (var i = path.length - 1; i >= 1; --i) {
code = path.charCodeAt(i)
if (code === 47 /*/*/) {
if (!matchedSlash) {
end = i
break
}
} else {
// We saw the first non-path separator
matchedSlash = false
}
}
if (end === -1) return hasRoot ? '/' : '.'
if (hasRoot && end === 1) return '//'