Gets the name of a number, even if it's stupidly big. Supersedes TheoryOfNekomata/number-name.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

173 líneas
2.7 KiB

  1. import { Group } from '../../common';
  2. export const DECIMAL_POINT = '.' as const;
  3. export const GROUPING_SYMBOL = ',' as const;
  4. export const NEGATIVE = 'negative' as const;
  5. export const NEGATIVE_SYMBOL = '-' as const;
  6. // replace with hyphen with option
  7. export const TENS_ONES_SEPARATOR = ' ' as const;
  8. export const POSITIVE_SYMBOL = '+' as const;
  9. export const SHORT_MILLIA_DELIMITER = '^' as const;
  10. export const EXPONENT_DELIMITER = 'e' as const;
  11. export const EMPTY_GROUP_DIGITS = '000' as const;
  12. export const EMPTY_PLACE: Group = [EMPTY_GROUP_DIGITS, BigInt(0)];
  13. /**
  14. * Ones number names.
  15. */
  16. export const ONES = [
  17. 'zero',
  18. 'one',
  19. 'two',
  20. 'three',
  21. 'four',
  22. 'five',
  23. 'six',
  24. 'seven',
  25. 'eight',
  26. 'nine',
  27. ] as const;
  28. export type OnesName = typeof ONES[number];
  29. /**
  30. * Ten plus ones number names.
  31. */
  32. export const TEN_PLUS_ONES = [
  33. 'ten',
  34. 'eleven',
  35. 'twelve',
  36. 'thirteen',
  37. 'fourteen',
  38. 'fifteen',
  39. 'sixteen',
  40. 'seventeen',
  41. 'eighteen',
  42. 'nineteen',
  43. ] as const;
  44. export type TenPlusOnesName = typeof TEN_PLUS_ONES[number];
  45. /**
  46. * Tens number names.
  47. */
  48. export const TENS = [
  49. 'zero',
  50. TEN_PLUS_ONES[0],
  51. 'twenty',
  52. 'thirty',
  53. 'forty',
  54. 'fifty',
  55. 'sixty',
  56. 'seventy',
  57. 'eighty',
  58. 'ninety',
  59. ] as const;
  60. export type TensName = typeof TENS[number];
  61. /**
  62. * Hundreds name.
  63. */
  64. export const HUNDRED = 'hundred' as const;
  65. /**
  66. * Thousands name.
  67. */
  68. export const THOUSAND = 'thousand' as const;
  69. // export const ILLION_ORDINAL_SUFFIX = 'illionth' as const;
  70. // export const THOUSAND_ORDINAL = 'thousandth' as const;
  71. /**
  72. * Special millions name.
  73. */
  74. export const MILLIONS_SPECIAL_PREFIXES = [
  75. '',
  76. 'm',
  77. 'b',
  78. 'tr',
  79. 'quadr',
  80. 'quint',
  81. 'sext',
  82. 'sept',
  83. 'oct',
  84. 'non',
  85. ] as const;
  86. export type MillionsSpecialPrefix = Exclude<typeof MILLIONS_SPECIAL_PREFIXES[number], ''>;
  87. /**
  88. * Millions name.
  89. */
  90. export const MILLIONS_PREFIXES = [
  91. '',
  92. 'un',
  93. 'duo',
  94. 'tre',
  95. 'quattuor',
  96. 'quin',
  97. 'sex',
  98. 'septen',
  99. 'octo',
  100. 'novem',
  101. ] as const;
  102. export type MillionsPrefix = Exclude<typeof MILLIONS_PREFIXES[number], ''>;
  103. /**
  104. * Decillions name.
  105. */
  106. export const DECILLIONS_PREFIXES = [
  107. '',
  108. 'dec',
  109. 'vigin',
  110. 'trigin',
  111. 'quadragin',
  112. 'quinquagin',
  113. 'sexagin',
  114. 'septuagin',
  115. 'octogin',
  116. 'nonagin',
  117. ] as const;
  118. export type DecillionsPrefix = Exclude<typeof DECILLIONS_PREFIXES[number], ''>;
  119. /**
  120. * Centillions name.
  121. */
  122. export const CENTILLIONS_PREFIXES = [
  123. '',
  124. 'cen',
  125. 'duocen',
  126. 'trecen',
  127. 'quadringen',
  128. 'quingen',
  129. 'sescen',
  130. 'septingen',
  131. 'octingen',
  132. 'nongen',
  133. ] as const;
  134. export type CentillionsPrefix = Exclude<typeof CENTILLIONS_PREFIXES[number], ''>;
  135. /**
  136. * Prefix for millia- number names.
  137. */
  138. export const MILLIA_PREFIX = 'millia' as const;
  139. /**
  140. * Suffix for -illion number names.
  141. */
  142. export const ILLION_SUFFIX = 'illion' as const;