-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move helper to new common place for view helpers
- Loading branch information
1 parent
d22e023
commit 6047574
Showing
2 changed files
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export function makeDisplayPath(pathItems) { | ||
const displayPathItems = !pathItems[0].includes(":") | ||
? ["", ...pathItems] | ||
: [...pathItems]; | ||
let displayPath = displayPathItems.join("/"); | ||
while (displayPathItems.length > 2 && displayPath.length > 60) { | ||
displayPathItems.splice(1, 1); | ||
displayPath = [displayPathItems[0], "...", ...displayPathItems.slice(1)].join("/"); | ||
} | ||
return displayPath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters