πŸ“„ formatDistance.cjs
/home/palash/git/site/node_modules/date-fns/locale/ko/_lib/formatDistance.cjs
Language: cjs β€’ Lines: 105
"use strict";
exports.formatDistance = void 0;

const formatDistanceLocale = {
  lessThanXSeconds: {
    one: "1초 미만",
    other: "{{count}}초 미만",
  },

  xSeconds: {
    one: "1초",
    other: "{{count}}초",
  },

  halfAMinute: "30초",

  lessThanXMinutes: {
    one: "1λΆ„ 미만",
    other: "{{count}}λΆ„ 미만",
  },

  xMinutes: {
    one: "1λΆ„",
    other: "{{count}}λΆ„",
  },

  aboutXHours: {
    one: "μ•½ 1μ‹œκ°„",
    other: "μ•½ {{count}}μ‹œκ°„",
  },

  xHours: {
    one: "1μ‹œκ°„",
    other: "{{count}}μ‹œκ°„",
  },

  xDays: {
    one: "1일",
    other: "{{count}}일",
  },

  aboutXWeeks: {
    one: "μ•½ 1μ£Ό",
    other: "μ•½ {{count}}μ£Ό",
  },

  xWeeks: {
    one: "1μ£Ό",
    other: "{{count}}μ£Ό",
  },

  aboutXMonths: {
    one: "μ•½ 1κ°œμ›”",
    other: "μ•½ {{count}}κ°œμ›”",
  },

  xMonths: {
    one: "1κ°œμ›”",
    other: "{{count}}κ°œμ›”",
  },

  aboutXYears: {
    one: "μ•½ 1λ…„",
    other: "μ•½ {{count}}λ…„",
  },

  xYears: {
    one: "1λ…„",
    other: "{{count}}λ…„",
  },

  overXYears: {
    one: "1λ…„ 이상",
    other: "{{count}}λ…„ 이상",
  },

  almostXYears: {
    one: "거의 1λ…„",
    other: "거의 {{count}}λ…„",
  },
};

const formatDistance = (token, count, options) => {
  let result;

  const tokenValue = formatDistanceLocale[token];
  if (typeof tokenValue === "string") {
    result = tokenValue;
  } else if (count === 1) {
    result = tokenValue.one;
  } else {
    result = tokenValue.other.replace("{{count}}", count.toString());
  }

  if (options?.addSuffix) {
    if (options.comparison && options.comparison > 0) {
      return result + " ν›„";
    } else {
      return result + " μ „";
    }
  }

  return result;
};
exports.formatDistance = formatDistance;