<commit_before>define [
  'jquery',
  'underscore',
  'mediator'
], ($, _, mediator) ->
  'use strict'

  # Utilities
  # ---------

  utils =

    # Object Helpers
    # --------------

    beget: do ->
      if typeof Object.create is 'function'
        (obj) ->
          Object.create(obj)
      else
        ctor = ->
        (obj) ->
          ctor:: = obj
          new ctor

    # String Helpers
    # --------------

    # camel-case-helper > camelCaseHelper
    camelize: do ->
      regexp = /[-_]([a-z])/g
      camelizer = (match, c) ->
        c.toUpperCase()
      (string) ->
        string.replace regexp, camelizer

    # Upcase the first character
    upcase: (str) ->
      str.charAt(0).toUpperCase() + str.substring(1)

    # underScoreHelper -> under_score_helper
    underscorize: do ->
      regexp = /[A-Z]/g
      underscorizer = (c) ->
        '_' + c.toLowerCase()
      (string) ->
        string.replace regexp, underscorizer

    # Persistent data storage
    # -----------------------

    # sessionStorage with session cookie fallback
    # sessionStorage(key) gets the value for 'key'
    # sessionStorage(key, value) set the value for 'key'
    sessionStorage: do ->
      if window.sessionStorage and sessionStorage.getItem and
      sessionStorage.setItem and sessionStorage.removeItem
        (key, value) ->
          if typeof value is 'undefined'
            value = sessionStorage.getItem(key)
            if value? and value.toString then value.toString() else value
          else
            sessionStorage.setItem(key, value)
            value
      else<commit_msg>Add dasherize util, fix underscorize on CamelCase.<commit_after>define [
  'jquery',
  'underscore',
  'mediator'
], ($, _, mediator) ->
  'use strict'

  # Utilities
  # ---------

  utils =

    # Object Helpers
    # --------------

    beget: do ->
      if typeof Object.create is 'function'
        (obj) ->
          Object.create(obj)
      else
        ctor = ->
        (obj) ->
          ctor:: = obj
          new ctor

    # String Helpers
    # --------------

    # camel-case-helper > camelCaseHelper
    camelize: do ->
      regexp = /[-_]([a-z])/g
      camelizer = (match, c) ->
        c.toUpperCase()
      (string) ->
        string.replace regexp, camelizer

    # Upcase the first character
    upcase: (str) ->
      str.charAt(0).toUpperCase() + str.substring(1)

    # underScoreHelper -> under_score_helper
    underscorize = do ->
      regExp = /[A-Z]/g
      underscorizer = (char) -> "_#{char.toLowerCase()}"
      (string) ->
        result = string.replace regExp, underscorizer
        result = result.substring(1) if result.charAt(0) is '_'
        result

    # dashHelper -> dash-helper
    dasherize = do ->
      regExp = /[A-Z]/g
      dasherizer = (char) -> "-#{char.toLowerCase()}"
      (string) ->
        result = string.replace regExp, dasherizer
        result = result.substring(1) if result.charAt(0) is '-'
        result

    # Persistent data storage
    # -----------------------

    # sessionStorage with session cookie fallback
    # sessionStorage(key) gets the value for 'key'
    # sessionStorage(key, value) set the value for 'key'
    sessionStorage: do ->
      if window.sessionStorage and sessionStorage.getItem and
      sessionStorage.setItem and sessionStorage.removeItem
        (key, value) ->
          if typeof value is 'undefined'
            value = sessionStorage.getItem(key)
            if value? and value.toString then value.toString() else value
          else
            sessionStorage.setItem(key, value)
            value
      else
{'fraction_non_alphanumeric': 0.1437620490223079, 'fraction_numerical': 0.002203249793445332, 'mean_word_length': 1.7788829380260138, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 39, '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': '4098856', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1060, 'n_words': 266}