Get the name of a number, even if it's stupidly big.
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
Questo repository è archiviato. Puoi vedere i file e clonarli, ma non puoi effettuare richieste di pushj o aprire problemi/richieste di pull.

28 righe
583 B

  1. import { Digit } from '../../../common'
  2. import NAMES from '../names'
  3. import ones from '../base/ones'
  4. import tenPlus from '../base/tenPlus'
  5. import getBaseTenTimesName from '../base/tenTimes'
  6. interface Tens {
  7. (x10: Digit, x1: Digit): string
  8. }
  9. const tens: Tens = (x10, x1) => {
  10. switch (x10) {
  11. case 0:
  12. return ones(x1)
  13. case 1:
  14. if (x1 > 0) {
  15. return tenPlus(x1)
  16. }
  17. break
  18. default:
  19. break
  20. }
  21. return x1 > 0 ? [getBaseTenTimesName(x10), "'", NAMES.and.slice(1), ' ', ones(x1)].join('') : getBaseTenTimesName(x10)
  22. }
  23. export default tens