Docs: 商店搜索大小写不敏感 (#1609)

This commit is contained in:
StarHeart 2023-01-22 11:31:32 +08:00 committed by GitHub
parent 6f57a290d7
commit f46addbb85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,14 +17,16 @@ export type Obj = {
};
export function filterObjs(filter: string, objs: Obj[]): Obj[] {
let filterLower = filter.toLowerCase();
return objs.filter((o) => {
return (
o.module_name?.includes(filter) ||
o.project_link?.includes(filter) ||
o.name.includes(filter) ||
o.desc.includes(filter) ||
o.author.includes(filter) ||
o.tags.filter((t) => t.label.includes(filter)).length > 0
o.module_name?.toLowerCase().includes(filterLower) ||
o.project_link?.toLowerCase().includes(filterLower) ||
o.name.toLowerCase().includes(filterLower) ||
o.desc.toLowerCase().includes(filterLower) ||
o.author.toLowerCase().includes(filterLower) ||
o.tags.filter((t) => t.label.toLowerCase().includes(filterLower)).length >
0
);
});
}