INNER CODE UNIT · JavaScript

assertPath

mx-space/core · apps/admin/polyfills/packages/path/index.js:3

function assertPath(path) {
  if (typeof path !== 'string') {
    throw new TypeError(
      `Path must be a string. Received ${JSON.stringify(path)}`,
    )
  }
}

// Resolves . and .. elements in a path with directory names
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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…