Gazebo_simulation-Frontend/node_modules/.cache/babel-loader/1a2e1a791cc7f7b4cabdf1d1aa6...

1 line
1.8 KiB
JSON

{"ast":null,"code":"function isAbsolute(pathname) {\n return pathname.charAt(0) === '/';\n} // About 1.5x faster than the two-arg version of Array#splice()\n\n\nfunction spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n} // This implementation is based heavily on node's url.parse\n\n\nfunction resolvePathname(to, from) {\n if (from === undefined) from = '';\n var toParts = to && to.split('/') || [];\n var fromParts = from && from.split('/') || [];\n var isToAbs = to && isAbsolute(to);\n var isFromAbs = from && isAbsolute(from);\n var mustEndAbs = isToAbs || isFromAbs;\n\n if (to && isAbsolute(to)) {\n // to is absolute\n fromParts = toParts;\n } else if (toParts.length) {\n // to is relative, drop the filename\n fromParts.pop();\n fromParts = fromParts.concat(toParts);\n }\n\n if (!fromParts.length) return '/';\n var hasTrailingSlash;\n\n if (fromParts.length) {\n var last = fromParts[fromParts.length - 1];\n hasTrailingSlash = last === '.' || last === '..' || last === '';\n } else {\n hasTrailingSlash = false;\n }\n\n var up = 0;\n\n for (var i = fromParts.length; i >= 0; i--) {\n var part = fromParts[i];\n\n if (part === '.') {\n spliceOne(fromParts, i);\n } else if (part === '..') {\n spliceOne(fromParts, i);\n up++;\n } else if (up) {\n spliceOne(fromParts, i);\n up--;\n }\n }\n\n if (!mustEndAbs) for (; up--; up) {\n fromParts.unshift('..');\n }\n if (mustEndAbs && fromParts[0] !== '' && (!fromParts[0] || !isAbsolute(fromParts[0]))) fromParts.unshift('');\n var result = fromParts.join('/');\n if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';\n return result;\n}\n\nexport default resolvePathname;","map":null,"metadata":{},"sourceType":"module"}