index.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var formatDistanceLocale = {
  7. lessThanXSeconds: {
  8. one: '1초 미만',
  9. other: '{{count}}초 미만'
  10. },
  11. xSeconds: {
  12. one: '1초',
  13. other: '{{count}}초'
  14. },
  15. halfAMinute: '30초',
  16. lessThanXMinutes: {
  17. one: '1분 미만',
  18. other: '{{count}}분 미만'
  19. },
  20. xMinutes: {
  21. one: '1분',
  22. other: '{{count}}분'
  23. },
  24. aboutXHours: {
  25. one: '약 1시간',
  26. other: '약 {{count}}시간'
  27. },
  28. xHours: {
  29. one: '1시간',
  30. other: '{{count}}시간'
  31. },
  32. xDays: {
  33. one: '1일',
  34. other: '{{count}}일'
  35. },
  36. aboutXWeeks: {
  37. one: '약 1주',
  38. other: '약 {{count}}주'
  39. },
  40. xWeeks: {
  41. one: '1주',
  42. other: '{{count}}주'
  43. },
  44. aboutXMonths: {
  45. one: '약 1개월',
  46. other: '약 {{count}}개월'
  47. },
  48. xMonths: {
  49. one: '1개월',
  50. other: '{{count}}개월'
  51. },
  52. aboutXYears: {
  53. one: '약 1년',
  54. other: '약 {{count}}년'
  55. },
  56. xYears: {
  57. one: '1년',
  58. other: '{{count}}년'
  59. },
  60. overXYears: {
  61. one: '1년 이상',
  62. other: '{{count}}년 이상'
  63. },
  64. almostXYears: {
  65. one: '거의 1년',
  66. other: '거의 {{count}}년'
  67. }
  68. };
  69. var formatDistance = function formatDistance(token, count, options) {
  70. var result;
  71. var tokenValue = formatDistanceLocale[token];
  72. if (typeof tokenValue === 'string') {
  73. result = tokenValue;
  74. } else if (count === 1) {
  75. result = tokenValue.one;
  76. } else {
  77. result = tokenValue.other.replace('{{count}}', count.toString());
  78. }
  79. if (options !== null && options !== void 0 && options.addSuffix) {
  80. if (options.comparison && options.comparison > 0) {
  81. return result + ' 후';
  82. } else {
  83. return result + ' 전';
  84. }
  85. }
  86. return result;
  87. };
  88. var _default = formatDistance;
  89. exports.default = _default;
  90. module.exports = exports.default;