mirror of https://github.com/zulip/zulip.git
util: Fix inefficient RegExp construction.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
6b92e71453
commit
83f696d217
|
@ -215,8 +215,9 @@ export const move_array_elements_to_front = function util_move_array_elements_to
|
||||||
|
|
||||||
// check by the userAgent string if a user's client is likely mobile.
|
// check by the userAgent string if a user's client is likely mobile.
|
||||||
export function is_mobile(): boolean {
|
export function is_mobile(): boolean {
|
||||||
const regex = "Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini";
|
return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(
|
||||||
return new RegExp(regex, "i").test(window.navigator.userAgent);
|
window.navigator.userAgent,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sorted_ids(ids: number[]): number[] {
|
export function sorted_ids(ids: number[]): number[] {
|
||||||
|
|
Loading…
Reference in New Issue