#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:
parent
daf657721c
commit
cd933cb4f0
|
@ -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) : ''
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue