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.

19 rivejä
474 B

  1. import { GetKiloCount, Digit } from '../../common'
  2. import constructTens from './construct/tens'
  3. import hundredTimes from './base/hundredTimes'
  4. const getKiloCount: GetKiloCount = (x100Raw, x10, x1) => {
  5. const x100 = Number(BigInt(x100Raw) % 10n) as Digit
  6. if (x100 < 1) {
  7. return constructTens(x10, x1)
  8. }
  9. if (x10 === 0 && x1 === 0) {
  10. return hundredTimes(x100)
  11. }
  12. return [hundredTimes(x100), constructTens(x10, x1)].join('')
  13. }
  14. export default getKiloCount