index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var formatDistanceLocale = {
  7. lessThanXSeconds: {
  8. one: 'nas lugha na diog',
  9. other: 'nas lugha na {{count}} diogan'
  10. },
  11. xSeconds: {
  12. one: '1 diog',
  13. two: '2 dhiog',
  14. twenty: '20 diog',
  15. other: '{{count}} diogan'
  16. },
  17. halfAMinute: 'leth mhionaid',
  18. lessThanXMinutes: {
  19. one: 'nas lugha na mionaid',
  20. other: 'nas lugha na {{count}} mionaidean'
  21. },
  22. xMinutes: {
  23. one: '1 mionaid',
  24. two: '2 mhionaid',
  25. twenty: '20 mionaid',
  26. other: '{{count}} mionaidean'
  27. },
  28. aboutXHours: {
  29. one: 'mu uair de thìde',
  30. other: 'mu {{count}} uairean de thìde'
  31. },
  32. xHours: {
  33. one: '1 uair de thìde',
  34. two: '2 uair de thìde',
  35. twenty: '20 uair de thìde',
  36. other: '{{count}} uairean de thìde'
  37. },
  38. xDays: {
  39. one: '1 là',
  40. other: '{{count}} là'
  41. },
  42. aboutXWeeks: {
  43. one: 'mu 1 seachdain',
  44. other: 'mu {{count}} seachdainean'
  45. },
  46. xWeeks: {
  47. one: '1 seachdain',
  48. other: '{{count}} seachdainean'
  49. },
  50. aboutXMonths: {
  51. one: 'mu mhìos',
  52. other: 'mu {{count}} mìosan'
  53. },
  54. xMonths: {
  55. one: '1 mìos',
  56. other: '{{count}} mìosan'
  57. },
  58. aboutXYears: {
  59. one: 'mu bhliadhna',
  60. other: 'mu {{count}} bliadhnaichean'
  61. },
  62. xYears: {
  63. one: '1 bhliadhna',
  64. other: '{{count}} bliadhna'
  65. },
  66. overXYears: {
  67. one: 'còrr is bliadhna',
  68. other: 'còrr is {{count}} bliadhnaichean'
  69. },
  70. almostXYears: {
  71. one: 'cha mhòr bliadhna',
  72. other: 'cha mhòr {{count}} bliadhnaichean'
  73. }
  74. };
  75. var formatDistance = function formatDistance(token, count, options) {
  76. var result;
  77. var tokenValue = formatDistanceLocale[token];
  78. if (typeof tokenValue === 'string') {
  79. result = tokenValue;
  80. } else if (count === 1) {
  81. result = tokenValue.one;
  82. } else if (count === 2 && !!tokenValue.two) {
  83. result = tokenValue.two;
  84. } else if (count === 20 && !!tokenValue.twenty) {
  85. result = tokenValue.twenty;
  86. } else {
  87. result = tokenValue.other.replace('{{count}}', String(count));
  88. }
  89. if (options !== null && options !== void 0 && options.addSuffix) {
  90. if (options.comparison && options.comparison > 0) {
  91. return 'ann an ' + result;
  92. } else {
  93. return 'o chionn ' + result;
  94. }
  95. }
  96. return result;
  97. };
  98. var _default = formatDistance;
  99. exports.default = _default;
  100. module.exports = exports.default;