mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 03:05:38 -05:00
implement proposal for fetching paths and retaining structure of dirs and packages (#914)
* implement proposal * update docs and replace py-env * more docs * suggested proposal * update docs * add to_file parameter * remove comment from Makefile * suggested improvements * move tests from basic to py_config * retain leading slash from the first path
This commit is contained in:
@@ -109,3 +109,12 @@ export function getAttribute(el: Element, attr: string): string | null {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function joinPaths(parts: string[], separator = '/') {
|
||||
const res = parts.map(function(part) { return part.trim().replace(/(^[/]*|[/]*$)/g, ''); }).filter(p => p!== "").join(separator || '/');
|
||||
if (parts[0].startsWith('/'))
|
||||
{
|
||||
return '/'+res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user