<commit_before>var pg = require('pg-promise')();
var Promise = require('bluebird');

var pgConnect = function(res, queries, dbConfig) {

  var config = {
    user: dbConfig.user,
    password: <PASSWORD>,
    server: dbConfig.connectString,
    port: dbConfig.port,
    database: dbConfig.database
  }
  var connection = pg(config);
  var searchResult = [];

  var promises = queries.map(function(query) {
    return connection.query(query.queryString)
      .then(function(result) {
        if (query.hasOwnProperty('cb')) {
          searchResult = searchResult.concat(query.cb(result));
        } else {
          searchResult = searchResult.concat(result);
        }
      }).catch(function(err) {
        console.log(err);
        // ... error checks
      });
  });

  return Promise.all(promises)
    .then(function() {
      return searchResult;
    })
    .catch(function(err) {
      console.log('err');
      // ... error checks
    });
}

module.exports = pgConnect;
<commit_msg>Updated the pg configuration object<commit_after>var pg = require('pg-promise')();
var Promise = require('bluebird');

var pgConnect = function(res, queries, dbConfig) {

  var config = {
    user: dbConfig.user,
    password: <PASSWORD>,
    host: dbConfig.connectString,
    port: dbConfig.port,
    database: dbConfig.database
  }
  var connection = pg(config);
  var searchResult = [];

  var promises = queries.map(function(query) {
    return connection.query(query.queryString)
      .then(function(result) {
        if (query.hasOwnProperty('cb')) {
          searchResult = searchResult.concat(query.cb(result));
        } else {
          searchResult = searchResult.concat(result);
        }
      }).catch(function(err) {
        console.log(err);
        // ... error checks
      });
  });

  return Promise.all(promises)
    .then(function() {
      return searchResult;
    })
    .catch(function(err) {
      console.log('err');
      // ... error checks
    });
}

module.exports = pgConnect;

{'fraction_non_alphanumeric': 0.14485514485514486, 'fraction_numerical': 0.0, 'mean_word_length': 2.635208711433757, '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': '848792', 'n_tokens_mistral': 597, 'n_tokens_neox': 592, 'n_words': 116}