<commit_before>var Promise = require('bluebird'),
    db;

module.exports = { 
  list : List,
  setDb : SetDB,
  getDb : GetDB
};

function List() {
  return new Promise(function(resolve,reject){
    db.admin().listDatabases().then(function(data){
      resolve(data);
    });    
  });
}

function SetDB(database) {
  db = database;
}

function GetDB(){
  return db;
}<commit_msg>Format response of dbList to exclude test and admin db and upate JSON body<commit_after>var Promise = require('bluebird'),
    db;

module.exports = { 
  list : List,
  setDb : SetDB,
  getDb : GetDB
};

function List() {

  var databases = [],
      formatted = [],
      len = [],
      currObj = {};

  return new Promise(function(resolve,reject){
    db.admin().listDatabases().then(function(data){
      databases = data.databases || [];
      len = databases.length;
      while(len--) {
        currObj = {'db_name' : databases[len].name,'stats' : {}};
        formatted.push(currObj);
        currObj = {};
      }
      formatted.splice(formatted.indexOf('admin'),1);
      formatted.splice(formatted.indexOf('test'),1);
      resolve(formatted);
    });    
  });
}

function SetDB(database) {
  db = database;
}

function GetDB(){
  return db;
}
{'fraction_non_alphanumeric': 0.15844785772029102, 'fraction_numerical': 0.0016168148746968471, 'mean_word_length': 2.9552715654952078, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '576326', 'n_tokens_mistral': 407, 'n_tokens_neox': 399, 'n_words': 82}