MySQL query optimization. Added loading component.

This commit is contained in:
Mike Cao 2020-08-27 23:45:37 -07:00
parent a7e7469d22
commit ccb98f836f
13 changed files with 158 additions and 109 deletions

View file

@ -49,12 +49,13 @@ export const urlFilter = (data, { domain, raw }) => {
};
export const refFilter = (data, { domain, domainOnly, raw }) => {
const regex = new RegExp(domain.startsWith('http') ? domain : `http[s]?://${domain}`);
const isValidRef = ref => {
return ref !== '' && !ref.startsWith('/') && !ref.startsWith('#');
};
if (raw) {
const regex = new RegExp(`http[s]?://${domain}`);
return data.filter(({ x }) => isValidRef(x) && !regex.test(x));
}
@ -62,7 +63,7 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
try {
const { hostname, origin, pathname, searchParams, protocol } = new URL(url);
if (hostname === domain) {
if (hostname === domain || regex.test(url)) {
return null;
}