feature(lib): add event type filter

This commit is contained in:
Alexander Klein 2021-02-15 13:02:12 +01:00
parent 30ebf7b266
commit 2cab8bb15d

View File

@ -113,6 +113,17 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
return Object.keys(map).map(key => ({ x: key, y: map[key], w: links[key] })); return Object.keys(map).map(key => ({ x: key, y: map[key], w: links[key] }));
}; };
export const eventTypeFilter = (data, types) => {
if (!types || types.length === 0) {
return data;
}
return data.filter(({ x }) => {
const [event] = x.split('\t');
return types.some(type => type === event);
});
};
export const browserFilter = data => export const browserFilter = data =>
data.map(({ x, y }) => ({ x: BROWSERS[x] || x, y })).filter(({ x }) => x); data.map(({ x, y }) => ({ x: BROWSERS[x] || x, y })).filter(({ x }) => x);