<commit_before>do ->
  type = (obj)->
    if obj == undefined or obj == null
      return String obj
    classToType = {
      '[object Boolean]' : 'boolean'  ,
      '[object Number]'  : 'number'   ,
      '[object String]'  : 'string'   ,
      '[object Function]': 'function' ,
      '[object Array]'   : 'array'    ,
      '[object Date]'    : 'date'     ,
      '[object RegExp]'  : 'regexp'   ,
      '[object Object]'  : 'object'   ,
      '[object Null]'    : 'null'
    }
    return classToType[Object.prototype.toString.call(obj)]

  arraysEqual = (a, b)->
    return true if a == b
    return false if (a == null || b == null)
    return false if (a.length != b.length)

    for i in [0...a.length]
      return false if (a[i] != b[i])

    true

  keysOf = (obj)-> key for key of obj when obj.hasOwnProperty(key)

  isEmpty = (obj)->
    for key in obj
      return false

    true

  beforeEach ->
    jasmine.addMatchers
      toBeATypeOf: (util, customEqualityTesters)->
        return compare: (actual, expected)->
          result = {}
          result.pass = type(actual) == expected
          result

      toBeAFunction: (util, customEqualityTesters)->
        return compare: (actual, expected = 'function')->
          result = {}
          result.pass = type(actual) == expected
          result

      toBeAnObject: (util, customEqualityTesters)->
        return compare: (actual, expected = 'object')->
          result = {}
          result.pass = type(actual) == expected
          result

      toBeAnArray: (util, customEqualityTesters)->
        return compare: (actual, expected = 'array')->
          result = {}
          result.pass = type(actual) == expected
          result

      toHaveProperties: (util, customEqualityTesters)->
        return compare: (actual, expected)->
          result = {}
          result.pass = arraysEqual(keysOf(actual), expected) if expected?
          result.pass ||= keysOf(actual).length > 0
          result

      toBeEmpty: (util, customEqualityTesters)->
        return compare: (actual, expected)->
          result = {}
          result.pass = isEmpty(actual)
          result<commit_msg>add new matcher toMatchSource<commit_after>do ->
  type = (obj)->
    if obj == undefined or obj == null
      return String obj
    classToType = {
      '[object Boolean]' : 'boolean'  ,
      '[object Number]'  : 'number'   ,
      '[object String]'  : 'string'   ,
      '[object Function]': 'function' ,
      '[object Array]'   : 'array'    ,
      '[object Date]'    : 'date'     ,
      '[object RegExp]'  : 'regexp'   ,
      '[object Object]'  : 'object'   ,
      '[object Null]'    : 'null'
    }
    return classToType[Object.prototype.toString.call(obj)]

  arraysEqual = (a, b)->
    return true if a == b
    return false if (a == null || b == null)
    return false if (a.length != b.length)

    for i in [0...a.length]
      return false if (a[i] != b[i])

    true

  keysOf = (obj)-> key for key of obj when obj.hasOwnProperty(key)

  isEmpty = (obj)->
    for key in obj
      return false

    true

  beforeEach ->
    jasmine.addMatchers
      toBeATypeOf: (util, customEqualityTesters)->
        return compare: (actual, expected)->
          result = {}
          result.pass = type(actual) == expected
          result

      toBeAFunction: (util, customEqualityTesters)->
        return compare: (actual, expected = 'function')->
          result = {}
          result.pass = type(actual) == expected
          result

      toBeAnObject: (util, customEqualityTesters)->
        return compare: (actual, expected = 'object')->
          result = {}
          result.pass = type(actual) == expected
          result

      toBeAnArray: (util, customEqualityTesters)->
        return compare: (actual, expected = 'array')->
          result = {}
          result.pass = type(actual) == expected
          result

      toHaveProperties: (util, customEqualityTesters)->
        return compare: (actual, expected)->
          result = {}
          result.pass = arraysEqual(keysOf(actual), expected) if expected?
          result.pass ||= keysOf(actual).length > 0
          result

      toBeEmpty: (util, customEqualityTesters)->
        return compare: (actual, expected)->
          result = {}
          result.pass = isEmpty(actual)
          result

      toMatchSource: (util, customEqualityTesters)->
        return compare: (actual, expected)->
          result = {}
          match = actual.toString().match(expected)
          result.pass = type(match) == 'array' && !isEmpty(match) || false
          result
{'fraction_non_alphanumeric': 0.13386851811672815, 'fraction_numerical': 0.0008678672163159037, 'mean_word_length': 2.0550033134526178, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 43, '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': '1751646', 'n_tokens_mistral': 1350, 'n_tokens_neox': 1299, 'n_words': 360}