Sha256: 561d54bad34dc6bc716b3bde35b0e75bc91cb2afffb07536cd6ba6255de1cc3a
Contents?: true
Size: 474 Bytes
Versions: 211
Compression:
Stored size: 474 Bytes
Contents
const possibleAllergies = [ 'eggs', 'peanuts', 'shellfish', 'strawberries', 'tomatoes', 'chocolate', 'pollen', 'cats' ]; class Allergies { constructor(allergenIndex) { this.allergenIndex = allergenIndex; } list() { return possibleAllergies.filter((allergy, i) => { return this.allergenIndex & Math.pow(2, i); }); } allergicTo(food) { return this.list().some(allergy => allergy === food); } } export default Allergies;
Version data entries
211 entries across 211 versions & 1 rubygems