<commit_before>function format_tag(tag, url_helper) {
  return {
    'id': url_helper.tag_url(tag),
    'web_url': null,
    'title': tag.title,
    'details': {
      'description': tag.description,
      'short_description': tag.short_description,
      'type': tag.tag_type
    },
    'content_with_tag': {
      'id': url_helper.with_tag_url(tag),
      'web_url': url_helper.tag_web_url(tag),
      'slug': tag.tag_id
    }
  };
} // format_tag

function format(tag, url_helper) {
  if (Array.isArray(tag))
    return tag.map(t => format_tag(t, url_helper));
  return format_tag(tag, url_helper);
} // format

module.exports = format;<commit_msg>bail if no tag - this happens in test, but could conceivably also happen in live<commit_after>function format_tag(tag, url_helper) {
  return {
    'id': url_helper.tag_url(tag),
    'web_url': null,
    'title': tag.title,
    'details': {
      'description': tag.description,
      'short_description': tag.short_description,
      'type': tag.tag_type
    },
    'content_with_tag': {
      'id': url_helper.with_tag_url(tag),
      'web_url': url_helper.tag_web_url(tag),
      'slug': tag.tag_id
    }
  };
} // format_tag

function format(tag, url_helper) {
  if (!tag)
    return {};

  if (Array.isArray(tag))
    return tag.map(t => format_tag(t, url_helper));
  return format_tag(tag, url_helper);
} // format

module.exports = format;
{'fraction_non_alphanumeric': 0.148890479599141, 'fraction_numerical': 0.0, 'mean_word_length': 3.36875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1313364', 'n_tokens_mistral': 495, 'n_tokens_neox': 502, 'n_words': 96}