index.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var formatDistanceLocale = {
  7. lessThanXSeconds: {
  8. one: 'פחות משנייה',
  9. two: 'פחות משתי שניות',
  10. other: 'פחות מ־{{count}} שניות'
  11. },
  12. xSeconds: {
  13. one: 'שנייה',
  14. two: 'שתי שניות',
  15. other: '{{count}} שניות'
  16. },
  17. halfAMinute: 'חצי דקה',
  18. lessThanXMinutes: {
  19. one: 'פחות מדקה',
  20. two: 'פחות משתי דקות',
  21. other: 'פחות מ־{{count}} דקות'
  22. },
  23. xMinutes: {
  24. one: 'דקה',
  25. two: 'שתי דקות',
  26. other: '{{count}} דקות'
  27. },
  28. aboutXHours: {
  29. one: 'כשעה',
  30. two: 'כשעתיים',
  31. other: 'כ־{{count}} שעות'
  32. },
  33. xHours: {
  34. one: 'שעה',
  35. two: 'שעתיים',
  36. other: '{{count}} שעות'
  37. },
  38. xDays: {
  39. one: 'יום',
  40. two: 'יומיים',
  41. other: '{{count}} ימים'
  42. },
  43. aboutXWeeks: {
  44. one: 'כשבוע',
  45. two: 'כשבועיים',
  46. other: 'כ־{{count}} שבועות'
  47. },
  48. xWeeks: {
  49. one: 'שבוע',
  50. two: 'שבועיים',
  51. other: '{{count}} שבועות'
  52. },
  53. aboutXMonths: {
  54. one: 'כחודש',
  55. two: 'כחודשיים',
  56. other: 'כ־{{count}} חודשים'
  57. },
  58. xMonths: {
  59. one: 'חודש',
  60. two: 'חודשיים',
  61. other: '{{count}} חודשים'
  62. },
  63. aboutXYears: {
  64. one: 'כשנה',
  65. two: 'כשנתיים',
  66. other: 'כ־{{count}} שנים'
  67. },
  68. xYears: {
  69. one: 'שנה',
  70. two: 'שנתיים',
  71. other: '{{count}} שנים'
  72. },
  73. overXYears: {
  74. one: 'יותר משנה',
  75. two: 'יותר משנתיים',
  76. other: 'יותר מ־{{count}} שנים'
  77. },
  78. almostXYears: {
  79. one: 'כמעט שנה',
  80. two: 'כמעט שנתיים',
  81. other: 'כמעט {{count}} שנים'
  82. }
  83. };
  84. var formatDistance = function formatDistance(token, count, options) {
  85. // Return word instead of `in one day` or `one day ago`
  86. if (token === 'xDays' && options !== null && options !== void 0 && options.addSuffix && count <= 2) {
  87. if (options.comparison && options.comparison > 0) {
  88. return count === 1 ? 'מחר' : 'מחרתיים';
  89. }
  90. return count === 1 ? 'אתמול' : 'שלשום';
  91. }
  92. var result;
  93. var tokenValue = formatDistanceLocale[token];
  94. if (typeof tokenValue === 'string') {
  95. result = tokenValue;
  96. } else if (count === 1) {
  97. result = tokenValue.one;
  98. } else if (count === 2) {
  99. result = tokenValue.two;
  100. } else {
  101. result = tokenValue.other.replace('{{count}}', String(count));
  102. }
  103. if (options !== null && options !== void 0 && options.addSuffix) {
  104. if (options.comparison && options.comparison > 0) {
  105. return 'בעוד ' + result;
  106. } else {
  107. return 'לפני ' + result;
  108. }
  109. }
  110. return result;
  111. };
  112. var _default = formatDistance;
  113. exports.default = _default;
  114. module.exports = exports.default;