<commit_before>/**
 * @module utilities
 * @return {Function} utilities
 */
define('utilities', [], function() {

  'use strict';

  return {

    /**
     * Convert a currency string into an integer.
     * @param {String} currency e.g. £24,000.12
     * @returns {Number} eg. 24000
     */
    currencyToInteger: function(currency) {
      return parseInt(currency.replace(/[£,]/g, ''), 10);
    },

    /**
     * Convert a number to a currency formatted string (rounded to the nearest integer)
     * @param {Number} num eg. 345893.90
     * @returns {String} eg. £345893
     */
    numberToCurrency: function(num) {
      var re = '\\d(?=(\\d{3})+$)';
      return '£' + Math.round(num).toFixed(0).replace(new RegExp(re, 'g'), '$&,');
    },

    /**
     * Converts a CamelCase string to a dashed-one
     * @param {string} str eg. TabSelector
     * @returns {string} eg. tab-selector
     */
    convertCamelCaseToDashed: function(str) {
      return str.replace(/([^\s])([A-Z][a-z])/g, '$1-$2').toLowerCase();
    },

    /**
     * Log function which checks for console presence
     * @param {string} message Log message
     * @param {string} type    Type of log message warn/info/table etc
     */
    log: function(message, type) {
      type = type ? type : 'log';

      if (this.doesConsoleExist(type)) {<commit_msg>Reworked regex to fix conversion of camelcase to dashed<commit_after>/**
 * @module utilities
 * @return {Function} utilities
 */
define('utilities', [], function() {

  'use strict';

  return {

    /**
     * Convert a currency string into an integer.
     * @param {String} currency e.g. £24,000.12
     * @returns {Number} eg. 24000
     */
    currencyToInteger: function(currency) {
      return parseInt(currency.replace(/[£,]/g, ''), 10);
    },

    /**
     * Convert a number to a currency formatted string (rounded to the nearest integer)
     * @param {Number} num eg. 345893.90
     * @returns {String} eg. £345893
     */
    numberToCurrency: function(num) {
      var re = '\\d(?=(\\d{3})+$)';
      return '£' + Math.round(num).toFixed(0).replace(new RegExp(re, 'g'), '$&,');
    },

    /**
     * Converts a CamelCase string to a dashed-one
     * @param {string} str eg. TabSelector
     * @returns {string} eg. tab-selector
     */
    convertCamelCaseToDashed: function(str) {
      if (str.length > 2) {
        // First replace aA patterns with a-A
        var str = str.replace(/([a-z])([A-Z])/g, '$1-$2')
                     // then AAa patterns with A-Aa
                     .replace(/([A-Z])([A-Z][a-z])/g, '$1-$2');
      }
      return str.toLowerCase();
    },

    /**
     * Log function which checks for console presence
     * @param {string} message Log message
     * @param {string} type    Type of log message warn/info/table etc
     */
    log: function(message, type) {
      type = type ? type : 'log';

      if (this.doesConsoleExist(type)) {
{'fraction_non_alphanumeric': 0.16615384615384615, 'fraction_numerical': 0.022905982905982905, 'mean_word_length': 2.374855824682814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '2456797', 'n_tokens_mistral': 992, 'n_tokens_neox': 932, 'n_words': 257}