All files / src/all Iterator.all.js

100% Statements 7/7
100% Branches 4/4
100% Functions 1/1
100% Lines 7/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15    19x 15x 1x     14x 37x 7x     7x    
import Iterator from '../iterators/Iterator';
 
Iterator.prototype.all = function all(condition) {
  if (!condition) {
    throw new Error('Missing condition');
  }
 
  for (let item of this) {
    if (!condition(item)) {
      return false;
    }
  }
  return true;
};