const ITEMS = [
'eggs',
'peanuts',
'shellfish',
'strawberries',
'tomatoes',
'chocolate',
'pollen',
'cats'
];
export class Allergies {
constructor(private mask: number) {}
public list(): string[] { return ITEMS.filter((_, i) => this.mask & (1 << i)); }
public allergicTo(item: string): boolean { return this.list().includes(item); }
}