<commit_before>var resolve = require('url').resolve
var join    = require('path').join

var regex   = /^iteration/i  // starts with 'Iteration'

//var progressbar      = /https?:\/\/feedopensource\.com\/(?:badge|iteration\/\w+\/w+)\/(1[1-km-z]{33})\/(\d+(?:\.\d+))/
var progressbar      =
  /https?:\/\/feedopensource\.com\/iteration\/[0-z_]+\/[0-z_]+\/(1[1-km-z]{33}).png#(\d+(?:\.\d+))/
var issueFull        = /https?:\/\/github.com\/([0-z_]+)\/([0-z_]+)\/issues\/(\d+)/
var issueNum         = /\s#(\d+)\s/
var issueUserNum     = /\s([0-z_]+)#(\d+)\s/
var issueUserRepoNum = /\s([0-z_]+)\/([0-z_]+)#(\d+)\s/

function matchAll(r, s) {
  var matches = []
  var m
  while(m = r.exec(s)) {
    matches.push(m)
    s = s.substring(m.index + 1)
  }
  return matches
}


module.exports = function (issues, collaborators, user, repo) {

  var iterations = []
  var wallets = {}

  var names = {}

  collaborators.forEach(function (user) {
    names[user.login] = true
  })

  var all = {}
  issues.forEach(function (issue) {
    all[issue.url] = issue
  })

  issues.forEach(function (issue) {

    //if(iteration.test(issue.title))
    if(!names[issue.user.login]) return
    var m = progressbar.exec(issue.body)

    issue.owner = user
    issue.repo = repo

    //console.log(issue.body)
    if(!m) return
    issue.wallet = m[1]
    issue.target = m[2]
    issue.feedopensource_url = 'https://feedopensource.com/iteration/' + user + '/' + repo + '/' + m[1]<commit_msg>enable override default host with config setting.<commit_after>var resolve = require('url').resolve
var join    = require('path').join
var config  = require('../config')

var host    = config.host || 'feedopensource.com'
var regex   = /^iteration/i  // starts with 'Iteration'

var progressbar      = new RegExp(
  "https?:\\/\\/" + host.replace(/\./, "\\.") + "\\/iteration\\/[0-z_]+\\/[0-z_]+\\/(1[1-km-z]{33}).png#(\\d+(?:\\.\\d+))")
var issueFull        = /https?:\/\/github.com\/([0-z_]+)\/([0-z_]+)\/issues\/(\d+)/
var issueNum         = /\s#(\d+)\s/
var issueUserNum     = /\s([0-z_]+)#(\d+)\s/
var issueUserRepoNum = /\s([0-z_]+)\/([0-z_]+)#(\d+)\s/

function matchAll(r, s) {
  var matches = []
  var m
  while(m = r.exec(s)) {
    matches.push(m)
    s = s.substring(m.index + 1)
  }
  return matches
}


module.exports = function (issues, collaborators, user, repo) {

  var iterations = []
  var wallets = {}

  var names = {}

  collaborators.forEach(function (user) {
    names[user.login] = true
  })

  var all = {}
  issues.forEach(function (issue) {
    all[issue.url] = issue
  })

  issues.forEach(function (issue) {

    //if(iteration.test(issue.title))
    if(!names[issue.user.login]) return
    var m = progressbar.exec(issue.body)

    issue.owner = user
    issue.repo = repo

    //console.log(issue.body)
    if(!m) return
    issue.wallet = m[1]
    issue.target = m[2]
    issue.feedopensource_url = 'https://' + host + '/iteration/' + user + '/' + repo + '/' + m[1]
{'fraction_non_alphanumeric': 0.22941970310391363, 'fraction_numerical': 0.011470985155195682, 'mean_word_length': 2.6158536585365852, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1408795', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1130, 'n_words': 197}