path-parse
path-parse copied to clipboard
It doesn't match Node's path.parse function in some cases
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' }
Also for /.., for a different reason.
index.js