<commit_before>var URL = /^((http|udp|ftp)s?:\/\/)?([a-zA-Z1-90-]{2,}\.)+?([a-zA-Z1-90-]{2,6})(:\d{2,})?(\/\S+)*$/;

/**
 * Returns true if str is a URL.
 *
 * @param (string) str
 * @return (boolean)
 */
exports.isURL = function(str) {
  return URL.test(str);
};


/**
 * Returns true if n is an integer.
 *
 * @param (number) n
 * @return (boolean)
 */
exports.isInteger = function(n) {
  return !isNaN(parseInt(n));
};


var SIZES = /((\d)+(\.\d+)?)(k|m|g|t)?b?/i
  , POWERS = {k: 10, m: 20, g: 30, t: 40}


/**
 * Returns bytes from human readable memory sizes such as 1.5MB
 *
 * @param (string|number) str
 * @return (number)
 */
exports.toBytes = function(str) {
  var result = SIZES.exec(str)
    , num    = parseFloat(result[1])
    , c      = result[4].toLowerCase()

  return POWERS[c] ? Math.round(num * (1 << POWERS[c])): num;
};


/**
 * Returns true if rs is a ReadableStream
 *
 * @param (stream.ReadableStream) rs
 * @return (boolean)
 */
var Stream = require('stream').Stream;
exports.isStream = function(rs) {
  return typeof rs === 'object' && rs instanceof Stream && rs.readable;
};

/**
 * Splits a path into an array, platform safe.
 *
 * @param (string) path<commit_msg>properly check for readable stream<commit_after>var URL = /^((http|udp|ftp)s?:\/\/)?([a-zA-Z1-90\-]{2,}\.)+?([a-zA-Z1-90\-]{2,6})(:\d{2,})?(\/\S+)*$/;

/**
 * Returns true if str is a URL.
 *
 * @param (string) str
 * @return (boolean)
 */
exports.isURL = function(str) {
  return URL.test(str);
};


/**
 * Returns true if n is an integer.
 *
 * @param (number) n
 * @return (boolean)
 */
exports.isInteger = function(n) {
  return !isNaN(parseInt(n, 10));
};


var SIZES = /((\d)+(\.\d+)?)(k|m|g|t)?b?/i
  , POWERS = {k: 10, m: 20, g: 30, t: 40}
  ;


/**
 * Returns bytes from human readable memory sizes such as 1.5MB
 *
 * @param (string|number) str
 * @return (number)
 */
exports.toBytes = function(str) {
  var result = SIZES.exec(str)
    , num    = parseFloat(result[1])
    , c      = result[4].toLowerCase()
    ;

  return POWERS[c] ? Math.round(num * (1 << POWERS[c])): num;
};


/**
 * Returns true if rs is a ReadableStream
 *
 * @param (stream.ReadableStream) rs
 * @return (boolean)
 */
exports.isReadableStream = function(rs) {
  return typeof rs === 'object' && typeof rs.pipe === 'function'
    && typeof rs.readable === 'boolean' && rs.readable;
};

/**
 * Splits a path into an array, platform safe.
 *
 * @param (string) path
{'fraction_non_alphanumeric': 0.21858370855505527, 'fraction_numerical': 0.019647973802701595, 'mean_word_length': 3.192109777015437, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5722086', 'n_tokens_mistral': 993, 'n_tokens_neox': 945, 'n_words': 230}