<commit_before>export function updatedAt(value) {
  if (!value) { return; }

  let timestamp = new Date(value * 1000);
  let hours = timestamp.getHours();
  let minutes = ("0" + timestamp.getMinutes()).slice(-2);
  let seconds = ("0" + timestamp.getSeconds()).slice(-2);

  return `Last updated at ${hours}:${minutes}:${seconds}`;
}

export function shortenedNumber(num) {
  if (isNaN(num)) { return num; }
  if (num >= 1000000000) { return (num / 1000000000).toFixed(1) + 'B'; }
  if (num >= 1000000) { return (num / 1000000).toFixed(1) + 'M'; }
  if (num >= 1000) { return (num / 1000).toFixed(1) + 'K'; }

  return num;
}

export function prettyNumber(num) {
  return isNaN(num) ? '' : num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

export function prepend(value, string) {
  return (string != null ? string : '') + (value != null ? value : '');
}

export function append(value, string) {
  return (value != null ? value : '') + (string != null ? string : '');
}<commit_msg>Add truncate helper function in helpers.js<commit_after>export function updatedAt(value) {
  if (!value) { return; }

  let timestamp = new Date(value * 1000);
  let hours = timestamp.getHours();
  let minutes = ("0" + timestamp.getMinutes()).slice(-2);
  let seconds = ("0" + timestamp.getSeconds()).slice(-2);

  return `Last updated at ${hours}:${minutes}:${seconds}`;
}

export function shortenedNumber(num) {
  if (isNaN(num)) { return num; }
  if (num >= 1000000000) { return (num / 1000000000).toFixed(1) + 'B'; }
  if (num >= 1000000) { return (num / 1000000).toFixed(1) + 'M'; }
  if (num >= 1000) { return (num / 1000).toFixed(1) + 'K'; }

  return num;
}

export function prettyNumber(num) {
  return isNaN(num) ? '' : num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

export function prepend(value, string) {
  return (string != null ? string : '') + (value != null ? value : '');
}

export function append(value, string) {
  return (value != null ? value : '') + (string != null ? string : '');
}

export function truncate(text, limit, omission) {
  if (!(typeof text === 'string')) { text = text + ""; }
  if (!(typeof limit === 'number') || isNaN(limit)) { limit = 30; }
  if (!(typeof omission === 'string')) { omission = '…'; }

  if (text.length <= limit) { return text; }

  return `${text.substr(0, limit)}${omission}`;
}
{'fraction_non_alphanumeric': 0.21413276231263384, 'fraction_numerical': 0.04753747323340471, 'mean_word_length': 3.9914529914529915, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '4665203', 'n_tokens_mistral': 883, 'n_tokens_neox': 772, 'n_words': 207}