Skip to content

Should pathe parse have the same return logic like node:path parse #167

@prisis

Description

@prisis

Environment

Package Version: 1.1.2
Node: v21.7.1
OS: Windows (Tested)

Reproduction

Node path

path.parse(".\\dir\\file")  -> { 
  root: '',
  dir: '.\\dir',
  base: 'file',
  ext: '',
  name: 'file' 
}

path.parse("C:\\path\\dir\\file.txt")  -> {
    root: "C:/",
    dir: "C:/path/dir",
    base: "file.txt",
    ext: ".txt",
    name: "file",
  }

Pathe

parse(".\\dir\\file")  -> {
    root: ".",
    dir: "./dir",
    base: "file",
    ext: "",
    name: "file",
  }

parse("C:\\path\\dir\\file.txt") -> {
    root: "C:",
    dir: "C:/path/dir",
    base: "file.txt",
    ext: ".txt",
    name: "file",
  }

Describe the bug

Im expecting the same result like nodes path.parse but with normalize path

Additional context

Will adjust the PR based on the ticket comments how to handle the return value of root

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions