mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
feature(lib): add event type filter
This commit is contained in:
parent
30ebf7b266
commit
2cab8bb15d
@ -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] }));
|
||||
};
|
||||
|
||||
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 =>
|
||||
data.map(({ x, y }) => ({ x: BROWSERS[x] || x, y })).filter(({ x }) => x);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user