class FoodObj { constructor(limit) { this.limit = limit; this.store = []; this.types = [0, 0, 0, 0, 0, 0, 0]; } get () { return this.store; } getFirstFive() { return (this.store.slice(0, 5)); } getFirstFiveIDs() { const outVal = this.store.slice(0, 5).map((item) => { return item._id; }); return (outVal); } add(item) { // console.log('>>', item); item.url = `https://menu.silvrtree.co.uk/view/${item.short}`; if (this.types[item.meat] < this.limit) { this.store.push(item); this.types[item.meat]++; } } count() { return (this.store.slice(0, 5).length); } } module.exports = FoodObj;