Use next-basics package.

This commit is contained in:
Mike Cao 2022-08-28 20:20:54 -07:00
parent 1a6af8fc41
commit f4e0da481e
62 changed files with 255 additions and 373 deletions

View file

@ -1,5 +1,3 @@
import { removeWWW } from './url';
export const urlFilter = data => {
const isValidUrl = url => {
return url !== '' && url !== null && !url.startsWith('#');
@ -49,7 +47,7 @@ export const refFilter = data => {
try {
const url = new URL(x);
id = removeWWW(url.hostname) || url.href;
id = url.hostname.replace('www', '') || url.href;
} catch {
id = '';
}
@ -94,11 +92,7 @@ export const paramFilter = data => {
return obj;
}, {});
const d = Object.keys(map).flatMap(key =>
return Object.keys(map).flatMap(key =>
Object.keys(map[key]).map(n => ({ x: `${key}=${n}`, p: key, v: n, y: map[key][n] })),
);
console.log({ map, d });
return d;
};