refactor frontend warren move api

This commit is contained in:
2025-07-30 21:56:50 +02:00
parent 3b141cc7cd
commit 956c0c6f65
4 changed files with 40 additions and 30 deletions

View File

@@ -16,3 +16,14 @@ export function splitOnce(
return [str.slice(0, index), str.slice(index + 1)];
}
export function trim(str: string, char: string) {
let start = 0;
let end = str.length;
while (start < end && str[start] === char) ++start;
while (end > start && str[end - 1] === char) --end;
return start > 0 || end < str.length ? str.substring(start, end) : str;
}