index.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var formatDistanceLocale = {
  7. lessThanXSeconds: {
  8. one: 'inqas minn sekonda',
  9. other: 'inqas minn {{count}} sekondi'
  10. },
  11. xSeconds: {
  12. one: 'sekonda',
  13. other: '{{count}} sekondi'
  14. },
  15. halfAMinute: 'nofs minuta',
  16. lessThanXMinutes: {
  17. one: 'inqas minn minuta',
  18. other: 'inqas minn {{count}} minuti'
  19. },
  20. xMinutes: {
  21. one: 'minuta',
  22. other: '{{count}} minuti'
  23. },
  24. aboutXHours: {
  25. one: 'madwar siegħa',
  26. other: 'madwar {{count}} siegħat'
  27. },
  28. xHours: {
  29. one: 'siegħa',
  30. other: '{{count}} siegħat'
  31. },
  32. xDays: {
  33. one: 'ġurnata',
  34. other: '{{count}} ġranet'
  35. },
  36. aboutXWeeks: {
  37. one: 'madwar ġimgħa',
  38. other: 'madwar {{count}} ġimgħat'
  39. },
  40. xWeeks: {
  41. one: 'ġimgħa',
  42. other: '{{count}} ġimgħat'
  43. },
  44. aboutXMonths: {
  45. one: 'madwar xahar',
  46. other: 'madwar {{count}} xhur'
  47. },
  48. xMonths: {
  49. one: 'xahar',
  50. other: '{{count}} xhur'
  51. },
  52. aboutXYears: {
  53. one: 'madwar sena',
  54. two: 'madwar sentejn',
  55. other: 'madwar {{count}} snin'
  56. },
  57. xYears: {
  58. one: 'sena',
  59. two: 'sentejn',
  60. other: '{{count}} snin'
  61. },
  62. overXYears: {
  63. one: 'aktar minn sena',
  64. two: 'aktar minn sentejn',
  65. other: 'aktar minn {{count}} snin'
  66. },
  67. almostXYears: {
  68. one: 'kważi sena',
  69. two: 'kważi sentejn',
  70. other: 'kważi {{count}} snin'
  71. }
  72. };
  73. var formatDistance = function formatDistance(token, count, options) {
  74. var result;
  75. var tokenValue = formatDistanceLocale[token];
  76. if (typeof tokenValue === 'string') {
  77. result = tokenValue;
  78. } else if (count === 1) {
  79. result = tokenValue.one;
  80. } else if (count === 2 && tokenValue.two) {
  81. result = tokenValue.two;
  82. } else {
  83. result = tokenValue.other.replace('{{count}}', String(count));
  84. }
  85. if (options !== null && options !== void 0 && options.addSuffix) {
  86. if (options.comparison && options.comparison > 0) {
  87. return "f'" + result;
  88. } else {
  89. return result + ' ilu';
  90. }
  91. }
  92. return result;
  93. };
  94. var _default = formatDistance;
  95. exports.default = _default;
  96. module.exports = exports.default;