<commit_before>(function(){
  var nextPage = function(elem) { return Rx.Observable.interval(200).where(function() { return elementBottomIsAlmostVisible(elem, 100) }) }

  var pager = function(ajaxSearch, page, next) {
    return ajaxSearch(page).selectMany(function(res) {
      if (res.length === 0)
        return rx.never()
      else
        return rx.returnValue(res).concat(next.take(1).selectMany(function() { return pager(ajaxSearch, page+1, next) }))
    })
  }

  var Pager = function() {}
  Pager.prototype.create = function(ajaxQuery, elem) { return pager(ajaxQuery, 1, nextPage(elem)) }
  OnTrail.pager = new Pager()
})()<commit_msg>fix pager -> empty is better than never for ending streams.<commit_after>(function(){
  var nextPage = function(elem) { return Rx.Observable.interval(200).where(function() { return elementBottomIsAlmostVisible(elem, 100) }) }

  var pager = function(ajaxSearch, page, next) {
    return ajaxSearch(page).selectMany(function(res) {
      if (res.length === 0)
        return rx.empty()
      else
        return rx.returnValue(res).concat(next.take(1).selectMany(function() { return pager(ajaxSearch, page+1, next) }))
    })
  }

  var Pager = function() {}
  Pager.prototype.create = function(ajaxQuery, elem) { return pager(ajaxQuery, 1, nextPage(elem)) }
  OnTrail.pager = new Pager()
})()
{'fraction_non_alphanumeric': 0.15022421524663676, 'fraction_numerical': 0.014947683109118086, 'mean_word_length': 4.1698841698841695, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4138681', 'n_tokens_mistral': 442, 'n_tokens_neox': 417, 'n_words': 91}