<commit_before>const HostUtil = {
  stringToHostname: function (string) {
    const HOSTNAME_MAX_LENGTH = 63;

    // Strip or convert illegal characters
    let host = string.toLowerCase().replace(/[_\.]/g, '-').replace(/[^a-z0-9-]/g, '');

    // Strip symbols from beginning
    while (host.startsWith('-')) {
      host = host.slice(1);<commit_msg>Add test for string being null in hostutil<commit_after>const HostUtil = {
  stringToHostname: function (string) {
    const HOSTNAME_MAX_LENGTH = 63;

    if (string == null) {
      return string;
    }

    // Strip or convert illegal characters
    let host = string.toLowerCase().replace(/[_\.]/g, '-').replace(/[^a-z0-9-]/g, '');

    // Strip symbols from beginning
    while (host.startsWith('-')) {
      host = host.slice(1);
{'fraction_non_alphanumeric': 0.1639135959339263, 'fraction_numerical': 0.012706480304955527, 'mean_word_length': 2.959798994974874, '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': '2453964', 'n_tokens_mistral': 259, 'n_tokens_neox': 249, 'n_words': 61}