remove last

This commit is contained in:
Victor Batischev
2024-02-28 19:59:56 +03:00
parent 57cc2bc1fa
commit 59d0f5eae6
11 changed files with 28 additions and 27 deletions

View File

@@ -92,7 +92,10 @@ export function copyProjectLink(projectId) {
);
}
export function removeLast(string) {
let lastIndex = string.lastIndexOf(" ");
return string.substring(0, lastIndex);
export function removeLast(string = " ") {
let arr = string.trim().split(" ");
if (arr.length > 2) {
return arr.slice(0, -1).join(" ");
}
return string;
}