mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-19 16:10:01 +02:00
feat: adding utils module (string manipulation function)
This commit is contained in:
parent
5b4c74f1c2
commit
7e5861ec22
12
frontend/src/utils/stringUtils.ts
Normal file
12
frontend/src/utils/stringUtils.ts
Normal file
@ -0,0 +1,12 @@
|
||||
export function getIdFromFullAccessPath(fullAccessPath: string) {
|
||||
// Replace '].' with a single dash
|
||||
let id = fullAccessPath.replace(/\]\./g, '-');
|
||||
|
||||
// Replace any character that is not a word character or underscore with a dash
|
||||
id = id.replace(/[^\w_]+/g, '-');
|
||||
|
||||
// Remove any trailing dashes
|
||||
id = id.replace(/-+$/, '');
|
||||
|
||||
return id;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user