Fix getUnique
MODIFY
packages/@romejs/path/index.ts
packages/@romejs/path/index.ts
@@ -272,7 +272,7 @@ class BaseFilePath<Super extends UnknownFilePath> {
}
getSegments(): PathSegments {
- if (this.isExplicitFolder() && this.segments.length !== 1) {
+ if (this.isExplicitFolder() && !this.isRoot()) {
return this.segments.slice(0, -1);
} else {
return this.segments;
@@ -290,6 +290,7 @@ class BaseFilePath<Super extends UnknownFilePath> {
let segments: undefined | PathSegments;
+ if (!this.isRoot()) {
if (this.isExplicitFolder()) {
segments = this.getSegments();
@@ -299,6 +300,7 @@ class BaseFilePath<Super extends UnknownFilePath> {
} else if (this.isExplicitRelative()) {
segments = this.getRawSegments().slice(1);
}
+ }
if (segments === undefined) {
return this._assert();

Fix getUnique