mirror of https://github.com/Lissy93/dashy.git
🔀 Merge pull request #1171 from ssrangisetti/patch-1
Add support searching multiple words.
This commit is contained in:
commit
9a416a4653
|
@ -11,7 +11,7 @@ import ErrorHandler from '@/utils/ErrorHandler';
|
||||||
const getDomainFromUrl = (url) => {
|
const getDomainFromUrl = (url) => {
|
||||||
if (!url) return '';
|
if (!url) return '';
|
||||||
const urlPattern = /^(?:https?:\/\/)?(?:w{3}\.)?([a-z\d.-]+)\.(?:[a-z.]{2,10})(?:[/\w.-]*)*/;
|
const urlPattern = /^(?:https?:\/\/)?(?:w{3}\.)?([a-z\d.-]+)\.(?:[a-z.]{2,10})(?:[/\w.-]*)*/;
|
||||||
const domainPattern = url.match(urlPattern);
|
const domainPattern = urlPattern.exec(url);
|
||||||
return domainPattern ? domainPattern[1] : '';
|
return domainPattern ? domainPattern[1] : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ const getDomainFromUrl = (url) => {
|
||||||
*/
|
*/
|
||||||
const filterHelper = (compareStr, searchStr) => {
|
const filterHelper = (compareStr, searchStr) => {
|
||||||
if (!compareStr) return false;
|
if (!compareStr) return false;
|
||||||
const process = (input) => input && input.toString().toLowerCase().replace(/[^\w\s]/gi, '');
|
const process = (input) => input?.toString().toLowerCase().replace(/[^\w\s]/gi, '');
|
||||||
return process(compareStr).includes(process(searchStr));
|
return process(searchStr).split(/\s/).every(word => process(compareStr).includes(word));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue