index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. standalone: 'мање од 1 секунде',
  10. withPrepositionAgo: 'мање од 1 секунде',
  11. withPrepositionIn: 'мање од 1 секунду'
  12. },
  13. dual: 'мање од {{count}} секунде',
  14. other: 'мање од {{count}} секунди'
  15. },
  16. xSeconds: {
  17. one: {
  18. standalone: '1 секунда',
  19. withPrepositionAgo: '1 секунде',
  20. withPrepositionIn: '1 секунду'
  21. },
  22. dual: '{{count}} секунде',
  23. other: '{{count}} секунди'
  24. },
  25. halfAMinute: 'пола минуте',
  26. lessThanXMinutes: {
  27. one: {
  28. standalone: 'мање од 1 минуте',
  29. withPrepositionAgo: 'мање од 1 минуте',
  30. withPrepositionIn: 'мање од 1 минуту'
  31. },
  32. dual: 'мање од {{count}} минуте',
  33. other: 'мање од {{count}} минута'
  34. },
  35. xMinutes: {
  36. one: {
  37. standalone: '1 минута',
  38. withPrepositionAgo: '1 минуте',
  39. withPrepositionIn: '1 минуту'
  40. },
  41. dual: '{{count}} минуте',
  42. other: '{{count}} минута'
  43. },
  44. aboutXHours: {
  45. one: {
  46. standalone: 'око 1 сат',
  47. withPrepositionAgo: 'око 1 сат',
  48. withPrepositionIn: 'око 1 сат'
  49. },
  50. dual: 'око {{count}} сата',
  51. other: 'око {{count}} сати'
  52. },
  53. xHours: {
  54. one: {
  55. standalone: '1 сат',
  56. withPrepositionAgo: '1 сат',
  57. withPrepositionIn: '1 сат'
  58. },
  59. dual: '{{count}} сата',
  60. other: '{{count}} сати'
  61. },
  62. xDays: {
  63. one: {
  64. standalone: '1 дан',
  65. withPrepositionAgo: '1 дан',
  66. withPrepositionIn: '1 дан'
  67. },
  68. dual: '{{count}} дана',
  69. other: '{{count}} дана'
  70. },
  71. aboutXWeeks: {
  72. one: {
  73. standalone: 'око 1 недељу',
  74. withPrepositionAgo: 'око 1 недељу',
  75. withPrepositionIn: 'око 1 недељу'
  76. },
  77. dual: 'око {{count}} недеље',
  78. other: 'око {{count}} недеље'
  79. },
  80. xWeeks: {
  81. one: {
  82. standalone: '1 недељу',
  83. withPrepositionAgo: '1 недељу',
  84. withPrepositionIn: '1 недељу'
  85. },
  86. dual: '{{count}} недеље',
  87. other: '{{count}} недеље'
  88. },
  89. aboutXMonths: {
  90. one: {
  91. standalone: 'око 1 месец',
  92. withPrepositionAgo: 'око 1 месец',
  93. withPrepositionIn: 'око 1 месец'
  94. },
  95. dual: 'око {{count}} месеца',
  96. other: 'око {{count}} месеци'
  97. },
  98. xMonths: {
  99. one: {
  100. standalone: '1 месец',
  101. withPrepositionAgo: '1 месец',
  102. withPrepositionIn: '1 месец'
  103. },
  104. dual: '{{count}} месеца',
  105. other: '{{count}} месеци'
  106. },
  107. aboutXYears: {
  108. one: {
  109. standalone: 'око 1 годину',
  110. withPrepositionAgo: 'око 1 годину',
  111. withPrepositionIn: 'око 1 годину'
  112. },
  113. dual: 'око {{count}} године',
  114. other: 'око {{count}} година'
  115. },
  116. xYears: {
  117. one: {
  118. standalone: '1 година',
  119. withPrepositionAgo: '1 године',
  120. withPrepositionIn: '1 годину'
  121. },
  122. dual: '{{count}} године',
  123. other: '{{count}} година'
  124. },
  125. overXYears: {
  126. one: {
  127. standalone: 'преко 1 годину',
  128. withPrepositionAgo: 'преко 1 годину',
  129. withPrepositionIn: 'преко 1 годину'
  130. },
  131. dual: 'преко {{count}} године',
  132. other: 'преко {{count}} година'
  133. },
  134. almostXYears: {
  135. one: {
  136. standalone: 'готово 1 годину',
  137. withPrepositionAgo: 'готово 1 годину',
  138. withPrepositionIn: 'готово 1 годину'
  139. },
  140. dual: 'готово {{count}} године',
  141. other: 'готово {{count}} година'
  142. }
  143. };
  144. var formatDistance = function formatDistance(token, count, options) {
  145. var result;
  146. var tokenValue = formatDistanceLocale[token];
  147. if (typeof tokenValue === 'string') {
  148. result = tokenValue;
  149. } else if (count === 1) {
  150. if (options !== null && options !== void 0 && options.addSuffix) {
  151. if (options.comparison && options.comparison > 0) {
  152. result = tokenValue.one.withPrepositionIn;
  153. } else {
  154. result = tokenValue.one.withPrepositionAgo;
  155. }
  156. } else {
  157. result = tokenValue.one.standalone;
  158. }
  159. } else if (count % 10 > 1 && count % 10 < 5 &&
  160. // if last digit is between 2 and 4
  161. String(count).substr(-2, 1) !== '1' // unless the 2nd to last digit is "1"
  162. ) {
  163. result = tokenValue.dual.replace('{{count}}', String(count));
  164. } else {
  165. result = tokenValue.other.replace('{{count}}', String(count));
  166. }
  167. if (options !== null && options !== void 0 && options.addSuffix) {
  168. if (options.comparison && options.comparison > 0) {
  169. return 'за ' + result;
  170. } else {
  171. return 'пре ' + result;
  172. }
  173. }
  174. return result;
  175. };
  176. var _default = formatDistance;
  177. exports.default = _default;
  178. module.exports = exports.default;