mirror of
https://github.com/Lissy93/dashy.git
synced 2025-12-31 13:03:25 +01:00
finish
This commit is contained in:
parent
802f47aa3d
commit
70fc6a93a9
1 changed files with 1 additions and 1 deletions
|
|
@ -3,7 +3,6 @@
|
|||
/* Tile filtering utility */
|
||||
import ErrorHandler from '@/utils/ErrorHandler';
|
||||
|
||||
// 预编译正则表达式,避免每次调用时重新编译
|
||||
// write regular expression first, avoidance of repetition.
|
||||
const SPECIAL_CHARS_REGEX = /[^\w\s\p{Alpha}]/giu;
|
||||
|
||||
|
|
@ -28,6 +27,7 @@ const getDomainFromUrl = (url) => {
|
|||
*/
|
||||
const filterHelper = (compareStr, searchStr) => {
|
||||
if (!compareStr) return false;
|
||||
// 使用预编译的正则表达式处理字符串
|
||||
const process = (input) => input?.toString().toLowerCase().replace(SPECIAL_CHARS_REGEX, '');
|
||||
return process(searchStr).split(/\s/).every(word => process(compareStr).includes(word));
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue