<commit_before>var _ = require('lodash')
var check = function (settings, req) {
  var mongoose = settings.mongoose
  settings.options.query.mongoose = mongoose.connection.readyState === 0 ? 0 : 1
  var defaults = settings.options.query
  var schemas = {}
  var query = req.query || {}
  var queryParameters = {}
  var schema = []
  var schemaSort = []
  queryParameters.error = {}
  queryParameters.warning = {}
  queryParameters.filter = {}
  if (defaults.mongoose) {
    var models = _.keys(mongoose.models) // mongoose Dependent things
    _.forEach(models, function (n, key) {
      schemas[n] = {} // currently collecting extra info for later use
      schemas[n].schema = []
      schemas[n].schemaSort = []
      schemas[n].tree = mongoose.models[n].schema.tree
      _.forEach(schemas[n].tree, function (j, key) {
        schema.push(key)
        schemaSort.push(key)<commit_msg>added the toBoolean function to implement next<commit_after>var _ = require('lodash')
function toBoolean (value) {
  if (!value) {
    return false
  }
  if (typeof value === 'number' || typeof value === 'boolean') {
    return !!value
  }
  if (_.toNumber(value)) {
    return !!_.replace(value, /[""'']/ig, '')
  } else {
    return _.replace(_.trim(value.toLowerCase()), /[""'']/ig, '') === 'true'
  }
}
_.mixin({
  'toBoolean': toBoolean
})

var check = function (settings, req) {
  var mongoose = settings.mongoose
  settings.options.query.mongoose = mongoose.connection.readyState === 0 ? 0 : 1
  var defaults = settings.options.query
  var schemas = {}
  var query = req.query || {}
  var queryParameters = {}
  var schema = []
  var schemaSort = []
  queryParameters.error = {}
  queryParameters.warning = {}
  queryParameters.filter = {}
  if (defaults.mongoose) {
    var models = _.keys(mongoose.models) // mongoose Dependent things
    _.forEach(models, function (n, key) {
      schemas[n] = {} // currently collecting extra info for later use
      schemas[n].schema = []
      schemas[n].schemaSort = []
      schemas[n].tree = mongoose.models[n].schema.tree
      _.forEach(schemas[n].tree, function (j, key) {
        schema.push(key)
        schemaSort.push(key)
{'fraction_non_alphanumeric': 0.15182279649284725, 'fraction_numerical': 0.0027688047992616522, 'mean_word_length': 3.217898832684825, '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': '5847429', 'n_tokens_mistral': 681, 'n_tokens_neox': 679, 'n_words': 158}