Environment
Node.js 18 & 22
Reproduction
const path = require("path");
const pathe = require("pathe");
console.log({
path: path.basename("sbin/a/"),
pathe: pathe.basename("sbin/a/"),
});
// { path: 'a', pathe: '' }
console.log({
path: path.basename("sbin/a///"),
pathe: pathe.basename("sbin/a///"),
});
// { path: 'a', pathe: '' }
https://replit.com/@isukkaw/ColossalGloriousWamp
Describe the bug
pathe.basename("sbin/a/") should return a instead of an empty string.
Additional context
Per Node.js basename documents: https://nodejs.org/api/path.html#pathbasenamepath-suffix
Trailing directory separators are ignored.
Logs
No response