How to make funkyonalnom style. The function returns true if limit is found. Searches for duplicates that repeat 2+ times
export default function(array, currentdata, limit = 2) { const { ac, sub} = currentData; let counter = 0; for (let j = 0; j < array.length; j++) { if (counter >= limit) { return true; } if (array[j].type1 === ac && array[j].type2 === sub) { counter++; } } return false; }
return array.some(function(el){return (this.limit-=array[j].type1 === ac && array[j].type2 === sub)<1},{limit})- Grundy