All files / src/first Iterator.first.js

100% Statements 4/4
100% Branches 2/2
100% Functions 1/1
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11      21x 94x 36x   58x      
import Iterator from '../iterators/Iterator';
import '../where';
 
Iterator.prototype.first = function first(condition) {
  if (condition) {
    return this.where(condition).first();
  } else {
    return this[Symbol.iterator]().next().value;
  }
};