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 lines
413 B

  1. import { JoinKilo } from '../../common'
  2. const joinKilo: JoinKilo = (kiloCount, kiloName) => {
  3. const kiloCountLastLetter = kiloCount.slice(-1)
  4. let kiloCountSuffix = ' na '
  5. if (['a', 'o'].includes(kiloCountLastLetter)) {
  6. kiloCountSuffix = 'ng '
  7. }
  8. if ('n' === kiloCountLastLetter) {
  9. kiloCountSuffix = 'g '
  10. }
  11. return [kiloCount, kiloCountSuffix, kiloName].join('')
  12. }
  13. export default joinKilo