mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 21:30:24 +08:00
Improve i18n.
This commit is contained in:
@ -112,6 +112,23 @@ export function swapRow(array, i, j) {
|
||||
return [...array.slice(0, i), array[j], ...array.slice(i + 1, j), array[i], ...array.slice(j + 1)];
|
||||
}
|
||||
|
||||
export function trim(str, ch) {
|
||||
if (str === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let start = 0;
|
||||
let end = str.length;
|
||||
|
||||
while(start < end && str[start] === ch)
|
||||
++start;
|
||||
|
||||
while(end > start && str[end - 1] === ch)
|
||||
--end;
|
||||
|
||||
return (start > 0 || end < str.length) ? str.substring(start, end) : str;
|
||||
}
|
||||
|
||||
export function isMobile() {
|
||||
// return getIsMobileView();
|
||||
return isMobileDevice;
|
||||
|
Reference in New Issue
Block a user