Get the name of a number, even if it's stupidly big.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

24 line
641 B

  1. import { GetKiloCount } from '../../common'
  2. import NAMES from './names'
  3. import constructTens from './construct/tens'
  4. import hundredTimes from './base/hundredTimes'
  5. const getKiloCount: GetKiloCount = (x100, x10, x1) => {
  6. if (x100 < 1) {
  7. return constructTens(x10, x1)
  8. }
  9. if (x10 === 0) {
  10. if (x1 === 0) {
  11. return hundredTimes(x100)
  12. }
  13. return [hundredTimes(x100), NAMES.and, constructTens(0, x1)].join(' ')
  14. }
  15. if (x10 === 1 || x1 === 0) {
  16. return [hundredTimes(x100), NAMES.and, constructTens(x10, x1)].join(' ')
  17. }
  18. return [hundredTimes(x100), constructTens(x10, x1)].join(' ')
  19. }
  20. export default getKiloCount