function toNamespacedPath(path) {
  // Note: this will *probably* throw somewhere.
  if (typeof path !== "string") return path;
  if (path.length === 0) return "";
  const resolvedPath = resolve(path);
  if (resolvedPath.length >= 3) {
    if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {
      // Possible UNC root
      if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {
        const code = resolvedPath.charCodeAt(2);
        if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {
          // Matched non-long UNC root, convert the path to a long UNC path
          return `\\\\?\\UNC\\${resolvedPath.slice(2)}`;
        }
      }
    } else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0))) {
      // Possible device root
      if (
        resolvedPath.charCodeAt(1) === CHAR_COLON &&
        resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH
      ) {
        // Matched device root, convert the path to a long UNC path
        return `\\\\?\\${resolvedPath}`;
      }
    }
  }
  return path;
}
/**
 * Resolves path to a namespace path
 * @param path to resolve to namespace
 */
Resolves path to a namespace path
@param path to resolve to namespace
Resolves path to a namespace path @param path to resolve to namespace
function toNamespacedPath(path) {
  if (typeof path !== "string") return path;
  if (path.length === 0) return "";
  const resolvedPath = resolve(path);
  if (resolvedPath.length >= 3) {
    if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {
      if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {
        const code = resolvedPath.charCodeAt(2);
        if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {
          return `\\\\?\\UNC\\${resolvedPath.slice(2)}`;
        }
      }
    } else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0))) {
      if (
        resolvedPath.charCodeAt(1) === CHAR_COLON &&
        resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH
      ) {
        return `\\\\?\\${resolvedPath}`;
      }
    }
  }
  return path;
}
function toNamespacedPath ( path ) { if ( typeof path !== "string" ) return path ; if ( path . length === 0 ) return "" ; const resolvedPath = resolve ( path ) ; if ( resolvedPath . length >= 3 ) { if ( resolvedPath . charCodeAt ( 0 ) === CHAR_BACKWARD_SLASH ) { if ( resolvedPath . charCodeAt ( 1 ) === CHAR_BACKWARD_SLASH ) { const code = resolvedPath . charCodeAt ( 2 ) ; if ( code !== CHAR_QUESTION_MARK && code !== CHAR_DOT ) { return ` \\ \\ \\ \\ ${ resolvedPath . slice ( 2 ) } ` ; } } } else if ( isWindowsDeviceRoot ( resolvedPath . charCodeAt ( 0 ) ) ) { if ( resolvedPath . charCodeAt ( 1 ) === CHAR_COLON && resolvedPath . charCodeAt ( 2 ) === CHAR_BACKWARD_SLASH ) { return ` \\ \\ \\ ${ resolvedPath } ` ; } } } return path ; }
Resolves path to a namespace path
 @param path to resolve to namespace
Resolves path to a namespace path @param path to resolve to namespace
// Note: this will *probably* throw somewhere. // Possible UNC root // Matched non-long UNC root, convert the path to a long UNC path // Possible device root // Matched device root, convert the path to a long UNC path