<commit_before>exports.VERSION_MAGIC = 131;
exports.tags = { 'SMALL_INTEGER' : 'a'
               , 'INTEGER'       : 'b'
               , 'FLOAT'         : 'c'
               , 'ATOM'          : 'd'
               , 'SMALL_ATOM'    : 's'
               , 'REFERENCE'     : 'e'
               , 'NEW_REFERENCE' : 'r'
               , 'PORT'          : 'f'
               , 'NEW_FLOAT'     : 'F'
               , 'PID'           : 'g'
               , 'SMALL_TUPLE'   : 'h'
               , 'LARGE_TUPLE'   : 'i'
               , 'NIL'           : 'j'
               , 'STRING'        : 'k'
               , 'LIST'          : 'l'
               , 'BINARY'        : 'm'
               , 'BIT_BINARY'    : 'M'
               , 'SMALL_BIG'     : 'n'
               , 'LARGE_BIG'     : 'o'
               , 'NEW_FUN'       : 'p'
               , 'EXPORT'        : 'q'
               , 'FUN'           : 'u'
               }

// Actually these need to be integers to be useful.
Object.keys(exports.tags).forEach(function(key) {
  exports.tags[key] = exports.tags[key].charCodeAt(0);
})

typeOf = exports.typeOf = function(value) {
  var s = typeof value;

  // Note: using Object.prototype.toString instead of instanceof because it's not working.
  if (s === 'object') {
    if (value) {
      if(Object.prototype.toString.apply(value) === '[object Array]') {
        s = 'array';
      }
    } else {
      s = 'null';
    }
  } else if(s === 'function' && Object.prototype.toString.apply(value) === '[object RegExp]') {
    return 'regexp';
  }
  return s;
}
<commit_msg>Support for "buffer" type in typeOf()<commit_after>exports.VERSION_MAGIC = 131;
exports.tags = { 'SMALL_INTEGER' : 'a'
               , 'INTEGER'       : 'b'
               , 'FLOAT'         : 'c'
               , 'ATOM'          : 'd'
               , 'SMALL_ATOM'    : 's'
               , 'REFERENCE'     : 'e'
               , 'NEW_REFERENCE' : 'r'
               , 'PORT'          : 'f'
               , 'NEW_FLOAT'     : 'F'
               , 'PID'           : 'g'
               , 'SMALL_TUPLE'   : 'h'
               , 'LARGE_TUPLE'   : 'i'
               , 'NIL'           : 'j'
               , 'STRING'        : 'k'
               , 'LIST'          : 'l'
               , 'BINARY'        : 'm'
               , 'BIT_BINARY'    : 'M'
               , 'SMALL_BIG'     : 'n'
               , 'LARGE_BIG'     : 'o'
               , 'NEW_FUN'       : 'p'
               , 'EXPORT'        : 'q'
               , 'FUN'           : 'u'
               }

// Actually these need to be integers to be useful.
Object.keys(exports.tags).forEach(function(key) {
  exports.tags[key] = exports.tags[key].charCodeAt(0);
})

function to_s(val) {
  return Object.prototype.toString.apply(val);
}

typeOf = exports.typeOf = function(value) {
  var s = typeof value;

  // Note: using Object.prototype.toString instead of instanceof because it's not working.
  if (s === 'object') {
    if (value) {
      if(to_s(value) === '[object Array]') {
        s = 'array';
      } else if(to_s(value) === '[object Buffer]') {
        s = 'buffer';
      }
    } else {
      s = 'null';
    }
  } else if(s === 'function' && to_s(value) === '[object RegExp]') {
    return 'regexp';
  }
  return s;
}

{'fraction_non_alphanumeric': 0.16030769230769232, 'fraction_numerical': 0.0024615384615384616, 'mean_word_length': 1.2359009628610729, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '426809', 'n_tokens_mistral': 1097, 'n_tokens_neox': 1080, 'n_words': 213}