Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ThreadLinkPicker.logic.ts

9 lines372 Bytes

1import { normalizeSearchText } from "~/lib/utils";
2​
3export function threadLinkMatcher(query: string, locale?: string) {
4 const localQuery = query.trim().toLocaleLowerCase(locale);
5 const foldedQuery = normalizeSearchText(query);
6 return (text: string) =>
7 text.toLocaleLowerCase(locale).includes(localQuery) ||
8 normalizeSearchText(text).includes(foldedQuery);
9}