<commit_before>var _       = require('lodash');
    _.str   = require('underscore.string');
var Joi     = require('joi');
var Promise = require('bluebird');

function modelBase(bookshelf, params) {
  if (!bookshelf) {
    throw new Error('Must pass an initialized bookshelf instance');
  }

  var model = bookshelf.Model.extend({
      initialize: function (attrs, options) {
        this.validation = options.validation || Joi.any();
        this.on('saving', this.validateSave);
      },

      validateSave: function () {
        return Joi.validate(this.attributes, this.validation);
      },
    }, {

      // snake_case db columns -> camelCase attributes
      // TODO: replace with lodash v3.0.0 _.camelCase
      _parse: function (response) {
        return  _.reduce(response, function (memo, val, key) {
          memo[_.str.camelize(key)] = val;<commit_msg>chore(comments): remove irrelevant todo<commit_after>var _       = require('lodash');
    _.str   = require('underscore.string');
var Joi     = require('joi');
var Promise = require('bluebird');

function modelBase(bookshelf, params) {
  if (!bookshelf) {
    throw new Error('Must pass an initialized bookshelf instance');
  }

  var model = bookshelf.Model.extend({
      initialize: function (attrs, options) {
        this.validation = options.validation || Joi.any();
        this.on('saving', this.validateSave);
      },

      validateSave: function () {
        return Joi.validate(this.attributes, this.validation);
      },
    }, {

      // snake_case db columns -> camelCase attributes
      _parse: function (response) {
        return  _.reduce(response, function (memo, val, key) {
          memo[_.str.camelize(key)] = val;
{'fraction_non_alphanumeric': 0.13625730994152047, 'fraction_numerical': 0.0017543859649122807, 'mean_word_length': 2.8886363636363637, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7495558', 'n_tokens_mistral': 507, 'n_tokens_neox': 485, 'n_words': 120}