query history with search

This commit is contained in:
Jan Prochazka
2021-06-03 15:52:46 +02:00
parent f6c8588573
commit 6362e2137b
3 changed files with 28 additions and 4 deletions

View File

@@ -39,6 +39,12 @@ export function filterName(filter: string, ...names: string[]) {
// const camelVariants = [name.replace(/[^A-Z]/g, '')]
const tokens = filter.split(' ').map(x => x.trim());
return !!_compact(names).find(name => !tokens.find(token => !name.toUpperCase().includes(token.toUpperCase())));
// return name.toUpperCase().includes(filter.toUpperCase());
const namesCompacted = _compact(names);
for (const token of tokens) {
const tokenUpper = token.toUpperCase();
const found = namesCompacted.find(name => name.toUpperCase().includes(tokenUpper));
if (!found) return false;
}
return true;
}