<commit_before>// Copyright (C) 2016 Goom Inc. All rights reserved.
import Decimal from 'decimal.js-light';

const format = (number) => {
  if (+number === 0) {
    return '0';
  }
  let res = '';
  let sign = '';
  if (number < 0) {
    sign = '-';
    number = -number;
  }
  const numToString = (num, zeros) => {
    let mul = 10;
    while (zeros > 0) {
      if (num < mul) {
        return `${Array(zeros).join('0')}${num}`;
      }
      zeros--;
      mul *= 10;
    }
    return num;
  };
  while (number > 0) {
    if (number >= 1000) {
      const mod = new Decimal(number).mod(1000).toNumber();
      res = `,${numToString(mod, 3)}${res}`;
    } else {
      res = `${number}${res}`;
    }
    number = new Decimal(number).divToInt(1000).toNumber();
  }
  return `${sign}${res}`;
};

exports.format = format;

const formatPrice = (price, currency, currencySign) => {
  if (currency === 'KRW') {
    return `${format(price)}원`;
  }
  return `${currencySign[currency]} ${price}`;
};

exports.formatPrice = formatPrice;

const formatDate = (date, isDateOnly) => {
  if (!(date instanceof Date)) {<commit_msg>uses 0 as default price in formatPrice.<commit_after>// Copyright (C) 2016 Goom Inc. All rights reserved.
import Decimal from 'decimal.js-light';

const format = (number) => {
  if (+number === 0) {
    return '0';
  }
  let res = '';
  let sign = '';
  if (number < 0) {
    sign = '-';
    number = -number;
  }
  const numToString = (num, zeros) => {
    let mul = 10;
    while (zeros > 0) {
      if (num < mul) {
        return `${Array(zeros).join('0')}${num}`;
      }
      zeros--;
      mul *= 10;
    }
    return num;
  };
  while (number > 0) {
    if (number >= 1000) {
      const mod = new Decimal(number).mod(1000).toNumber();
      res = `,${numToString(mod, 3)}${res}`;
    } else {
      res = `${number}${res}`;
    }
    number = new Decimal(number).divToInt(1000).toNumber();
  }
  return `${sign}${res}`;
};

exports.format = format;

const formatPrice = (price, currency, currencySign) => {
  if (currency === 'KRW') {
    return `${format(price)}원`;
  }
  return `${currencySign[currency]} ${price || 0}`;
};

exports.formatPrice = formatPrice;

const formatDate = (date, isDateOnly) => {
  if (!(date instanceof Date)) {
{'fraction_non_alphanumeric': 0.19646799116997793, 'fraction_numerical': 0.024724061810154525, 'mean_word_length': 2.7147540983606557, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '2983026', 'n_tokens_mistral': 834, 'n_tokens_neox': 807, 'n_words': 201}