<commit_before>//
//  toolbox.js
//  gb-toolbox
//
//  Created by <NAME> on 17/04/2014.
//  Copyright (c) 2014 Goonbee. All rights reserved.
//

var _ = require('underscore');

var P = function() {
  this.slice = Array.prototype.slice;

  this.requiredSomething = function(what) {
    return function() {
      _.each(arguments, function(argument, index) {
        if (_.isUndefined(argument)) throw new Error('Required ' + what + ' (' + index + ') not supplied');
      });
    };
  };
};
var p = new P();

var Toolbox = function() {
  this.requiredArguments = p.requiredSomething('argument');

  this.requiredVariables = p.requiredSomething('variable');

  this.contains = function(array, target) {
    if (array !== null) {
      return array.indexOf(target) !== -1;
    }
    else {
      return false;
    }
  };

  this.optional = function(variable, fallback) {
    return ((typeof variable !== 'undefined') && (variable !== null)) ? variable : fallback;
  };

  this.getCurrentISODate = function() {
    return new Date().toISOString();
  };

  this.addToSet = function(array, item) {
    if (!toolbox.contains(array, item)) array.push(item);
  };

  this.removeFromArray = function(array, item) {
    var index = array.indexOf(item);<commit_msg>Removed duplicated method present in underscore<commit_after>//
//  toolbox.js
//  gb-toolbox
//
//  Created by <NAME> on 17/04/2014.
//  Copyright (c) 2014 Goonbee. All rights reserved.
//

var _ = require('underscore');

var P = function() {
  this.slice = Array.prototype.slice;

  this.requiredSomething = function(what) {
    return function() {
      _.each(arguments, function(argument, index) {
        if (_.isUndefined(argument)) throw new Error('Required ' + what + ' (' + index + ') not supplied');
      });
    };
  };
};
var p = new P();

var Toolbox = function() {
  this.requiredArguments = p.requiredSomething('argument');

  this.requiredVariables = p.requiredSomething('variable');

  this.optional = function(variable, fallback) {
    return ((typeof variable !== 'undefined') && (variable !== null)) ? variable : fallback;
  };

  this.getCurrentISODate = function() {
    return new Date().toISOString();
  };

  this.addToSet = function(array, item) {
    if (!_.contains(array, item)) array.push(item);
  };

  this.removeFromArray = function(array, item) {
    var index = array.indexOf(item);
{'fraction_non_alphanumeric': 0.163575042158516, 'fraction_numerical': 0.010539629005059023, 'mean_word_length': 3.2756756756756755, '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': '2696047', 'n_tokens_mistral': 759, 'n_tokens_neox': 722, 'n_words': 172}