<commit_before>// this module merges together human-maintained database
// and automatically fetched data, and normalizes everything

//
// maintainers data
//
var maintainers = module.exports.maintainers = {}
mixin(maintainers, require('./maintainers.json'))
try {
  mixin(maintainers, require('./db.json').maintainers)
} catch(_){}

//
// projects data
//
var projects = module.exports.projects = {}
mixin(projects, require('./projects.json'), true)
try {
  mixin(projects, require('./db.json').projects)
} catch(_){}

// normalize
for (var name in projects) {
  var project = projects[name]
  project.name = project.name || name
  project.npm = project.npm || name.toLowerCase()
  project.repo = project.repo || ('jshttp/' + project.npm)
  project.maintainer = maintainers[project.maintainer]
}

//
// helpers
//
function mixin(obj, stuff, sort) {
  var keys = Object.keys(stuff)
  if (sort) keys = keys.sort()
  keys.forEach(function(i) {
    if (typeof(obj[i]) === 'object') {
      mixin(obj[i], stuff[i])
    } else if (!obj[i]) {
      obj[i] = stuff[i]
    }
  })<commit_msg>default repo to <org>/<project.name><commit_after>// this module merges together human-maintained database
// and automatically fetched data, and normalizes everything

//
// maintainers data
//
var maintainers = module.exports.maintainers = {}
mixin(maintainers, require('./maintainers.json'))
try {
  mixin(maintainers, require('./db.json').maintainers)
} catch(_){}

//
// projects data
//
var projects = module.exports.projects = {}
mixin(projects, require('./projects.json'), true)
try {
  mixin(projects, require('./db.json').projects)
} catch(_){}

// normalize
for (var name in projects) {
  var project = projects[name]
  project.name = project.name || name
  project.npm = project.npm || name.toLowerCase()
  project.repo = project.repo || ('jshttp/' + project.name)
  project.maintainer = maintainers[project.maintainer]
}

//
// helpers
//
function mixin(obj, stuff, sort) {
  var keys = Object.keys(stuff)
  if (sort) keys = keys.sort()
  keys.forEach(function(i) {
    if (typeof(obj[i]) === 'object') {
      mixin(obj[i], stuff[i])
    } else if (!obj[i]) {
      obj[i] = stuff[i]
    }
  })
{'fraction_non_alphanumeric': 0.17335766423357665, 'fraction_numerical': 0.0, 'mean_word_length': 3.7060085836909873, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2293099', 'n_tokens_mistral': 727, 'n_tokens_neox': 705, 'n_words': 165}