path-parse icon indicating copy to clipboard operation
path-parse copied to clipboard

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

Open fabiospampinato opened this issue 10 months ago • 2 comments

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' }

fabiospampinato avatar Mar 09 '25 01:03 fabiospampinato

Also for /.., for a different reason.

fabiospampinato avatar Mar 09 '25 02:03 fabiospampinato

index.js

dd01050321458-cpu avatar Sep 23 '25 05:09 dd01050321458-cpu