<commit_before>var _ = require('lodash');

exports.formatNumber = function(dialect) {
  return {
    mysql: _.identity,
    sqlite3: _.identity,
    postgresql: function(count) { return count.toString() }
  }[dialect];
}

exports.countModels = function countModels(Model, options) {
  return function() {
    return Model.forge().count(options);
  }
}
<commit_msg>Convert count() result to number if it's a string<commit_after>var _ = require('lodash');

exports.formatNumber = function(dialect) {
  return {
    mysql: _.identity,
    sqlite3: _.identity,
    postgresql: function(count) { return count.toString() }
  }[dialect];
}

exports.countModels = function countModels(Model, options) {
  return function() {
    return Model.forge().count(options).then(function(count) {
      if (typeof count === 'string') return parseInt(count);
      return count;
    });
  }
}

{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.002285714285714286, 'mean_word_length': 4.063583815028902, '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': '7200814', 'n_tokens_mistral': 278, 'n_tokens_neox': 267, 'n_words': 60}