<commit_before>export const isDev = process.env.NODE_ENV === 'development';

export function getPlatformString() {
  try {
    const platform = navigator.platform.toLowerCase();
    let trimmed = '';
    if (platform.indexOf('mac') !== -1) {
      trimmed = 'mac';
    } else if (platform.indexOf('win') !== -1) {
      trimmed = 'windows';
    }
    if (platform.indexOf('linux') !== -1) {
      trimmed = 'linux';
    }
    return trimmed + (isDesktopApplication() ? '-desktop' : '-web');
  } catch (e) {
    return 'unknown-platform';
  }
}

let sharedDateFormatter: Intl.DateTimeFormat;
export function dateToLocalizedString(date: Date) {
  if (typeof Intl !== 'undefined' && Intl.DateTimeFormat) {
    if (!sharedDateFormatter) {
      const locale = (
        (navigator.languages && navigator.languages.length)
          ? navigator.languages[0]
          : navigator.language
      );
      sharedDateFormatter = new Intl.DateTimeFormat(locale, {
        year: 'numeric',
        month: 'numeric',
        day: '2-digit',
        hour: '2-digit',
        minute: '2-digit',
      });
    }
    return sharedDateFormatter.format(date);
  } else {
    // IE < 11, Safari <= 9.0.
    // In English, this generates the string most similar to
    // the toLocaleDateString() result above.<commit_msg>fix: fall back to treating unknown platforms as linux-web<commit_after>export const isDev = process.env.NODE_ENV === 'development';

export function getPlatformString() {
  try {
    const platform = navigator.platform.toLowerCase();
    let trimmed = '';
    if (platform.includes('mac')) {
      trimmed = 'mac';
    } else if (platform.includes('win')) {
      trimmed = 'windows';
    } else if (platform.includes('linux')) {
      trimmed = 'linux';
    } else {
      /** Treat other platforms as linux */
      trimmed = 'linux';
    }
    return trimmed + (isDesktopApplication() ? '-desktop' : '-web');
  } catch (e) {
    return 'linux-web';
  }
}

let sharedDateFormatter: Intl.DateTimeFormat;
export function dateToLocalizedString(date: Date) {
  if (typeof Intl !== 'undefined' && Intl.DateTimeFormat) {
    if (!sharedDateFormatter) {
      const locale = (
        (navigator.languages && navigator.languages.length)
          ? navigator.languages[0]
          : navigator.language
      );
      sharedDateFormatter = new Intl.DateTimeFormat(locale, {
        year: 'numeric',
        month: 'numeric',
        day: '2-digit',
        hour: '2-digit',
        minute: '2-digit',
      });
    }
    return sharedDateFormatter.format(date);
  } else {
    // IE < 11, Safari <= 9.0.
    // In English, this generates the string most similar to
    // the toLocaleDateString() result above.
{'fraction_non_alphanumeric': 0.14364844903988183, 'fraction_numerical': 0.007016248153618907, 'mean_word_length': 2.665764546684709, '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': '3493697', 'n_tokens_mistral': 820, 'n_tokens_neox': 797, 'n_words': 197}