Skip to content

Commit

Permalink
fix: trim whitespace when splitting path
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan committed Oct 13, 2019
1 parent 68c23f1 commit 6d33a31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/path/meta/segments.ts
Expand Up @@ -19,7 +19,7 @@ const segments = (path: string) => {
const result = path.split(sep);

if (hasRoot) {
result.unshift(sep);
result[0] = sep;
}

return result;
Expand Down
4 changes: 3 additions & 1 deletion test/path/meta/segments.test.ts
Expand Up @@ -23,7 +23,9 @@ describe("path", () => {
});

it("should include root path", () => {
const path = flexi.path("/some/path/with/root");
const stringPath = "/some/path/with/root";

const path = flexi.path(stringPath);

const [root] = path.segments;

Expand Down

0 comments on commit 6d33a31

Please sign in to comment.