#74 - Integration with Bookmarks core plugin and support for indirect drag & drop arrangement

- update of treatment of whitespace in parent path extraction: spaces allowed as leading/trailing in path elements
- unit tests
This commit is contained in:
SebastianMC 2023-10-19 14:48:48 +02:00
parent daf657721c
commit cd933cb4f0
2 changed files with 6 additions and 6 deletions

View File

@ -9,10 +9,10 @@ export function last<T>(o: Array<T>): T | undefined {
export function lastPathComponent(path: string): string { export function lastPathComponent(path: string): string {
const lastPathSeparatorIdx = (path ?? '').lastIndexOf('/') const lastPathSeparatorIdx = (path ?? '').lastIndexOf('/')
return lastPathSeparatorIdx >= 0 ? path.substring(lastPathSeparatorIdx + 1).trim() : path.trim() return lastPathSeparatorIdx >= 0 ? path.substring(lastPathSeparatorIdx + 1) : path
} }
export function extractParentFolderPath(path: string): string { export function extractParentFolderPath(path: string): string {
const lastPathSeparatorIdx = (path ?? '').lastIndexOf('/') const lastPathSeparatorIdx = (path ?? '').lastIndexOf('/')
return lastPathSeparatorIdx > 0 ? path.substring(0, lastPathSeparatorIdx).trim() : '' return lastPathSeparatorIdx > 0 ? path.substring(0, lastPathSeparatorIdx) : ''
} }