1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 18x 14x 3x 11x 11x 25x 11x | import Iterator from '../iterators/Iterator'; import '../where'; Iterator.prototype.count = function count(condition) { if (condition) { return this.where(condition).count(); } else { let count = 0; for (let item of this) { count++; } return count; } }; |