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.

17 lines
469 B

  1. import { Digit } from '../../../common'
  2. import NAMES from '../names'
  3. interface HundredTimes {
  4. (x100: Digit): string
  5. }
  6. /**
  7. * Get the name of some number in the hundreds place.
  8. * @param {number} x100 - The number in the hundreds place.
  9. * @returns {string} The name of the number in the hundreds place.
  10. */
  11. const hundredTimes: HundredTimes = (x100) =>
  12. Number(x100) === 0 ? NAMES.units[0] : [NAMES.units[x100], NAMES.hundred].join('')
  13. export default hundredTimes