File size: 457 Bytes
c09f67c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
type BlocklistEntry = {
  type: "email" | "domain";
  value: string;
};

export function separateBlocklistEntries(entries: BlocklistEntry[]) {
  const blockedDomains = entries
    .filter((entry) => entry.type === "domain")
    .map((entry) => entry.value.toLowerCase());
  const blockedEmails = entries
    .filter((entry) => entry.type === "email")
    .map((entry) => entry.value.toLowerCase());

  return {
    blockedDomains,
    blockedEmails,
  };
}