Package to replace
path-root (+path-root-regex)
Suggested replacement(s)
for node
import { parse} from 'node:path';
parse(filepath).root;
for browser leave
const ROOT_RE = /^(?:[a-zA-Z]:|[\\/]{2}[^\\/]+[\\/]+[^\\/]+)?[\\/]?;
export default (filepath) => {
if (typeof filepath !== 'string') throw new TypeError('expected a string');
return ROOT_RE.exec(filepath)[0];
};
Manifest type
micro-utility (tiny utility replaceable with native code or removal)
Rationale
inlinable
Availability
No response
Code example (optional)
Package to replace
path-root(+path-root-regex)Suggested replacement(s)
for node
for browser leave
Manifest type
micro-utility (tiny utility replaceable with native code or removal)
Rationale
inlinable
Availability
No response
Code example (optional)