Skip to content

It doesn't match Node's path.parse function in some cases #24

@fabiospampinato

Description

@fabiospampinato

Repro:

import path from 'node:path';
import pparse from 'path-parse';

console.log('/');
console.log(pparse.posix('/'));
console.log(path.posix.parse('/'));

console.log('foo/bar/');
console.log(pparse.posix('foo/bar/'));
console.log(path.posix.parse('foo/bar/'));

Output:

/
{ root: '/', dir: '', base: '', ext: '', name: '' }
{ root: '/', dir: '/', base: '', ext: '', name: '' }
foo/bar/
{ root: '', dir: 'foo/bar', base: '', ext: '', name: '' }
{ root: '', dir: 'foo', base: 'bar', ext: '', name: 'bar' }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions