<commit_before>import r from 'rethinkdb';

export default {
  getEmptyChunkTable(dbConn) {
    return new Promise(function(resolve, reject) {
      r.table('chunk').isEmpty().run(dbConn, function(error, data) {
        resolve(data);
      });
    });
  },
  saveChunks(dbConn, chunks) {
    return new Promise(function(resolve, reject) {
      r.table('chunk').insert(chunks).run(dbConn, function(error, data) {
        resolve(data);
      });
    });
  }
};<commit_msg>es6 fixes and new function.<commit_after>import Promise from 'bluebird';
import r from 'rethinkdb';

export default {
  getEmptyChunkTable(dbConn) {
    return new Promise((resolve, reject) => {
      r.table('chunk').isEmpty().run(dbConn, (error, data) => {
        resolve(data);
      });
    });
  },
  saveChunks(dbConn, chunks) {
    return new Promise((resolve, reject) => {
      r.table('chunk').insert(chunks).run(dbConn, (error, data) => {
        if (error) reject(error);
        resolve(data);
      });
    });
  },
  getChunks(dbConn) {
    return new Promise((resolve, reject) => {
      r.table('chunk').run(dbConn, (error, data) => {
        if (error) reject(error);
        resolve(data.toArray());
      });
    });
  }
};
{'fraction_non_alphanumeric': 0.17598684210526316, 'fraction_numerical': 0.0008223684210526315, 'mean_word_length': 2.977124183006536, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1265063', 'n_tokens_mistral': 391, 'n_tokens_neox': 389, 'n_words': 73}