Get the name of a number, even if it's stupidly big.
25개 이상의 토픽을 선택하실 수 없습니다.
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.
|
- import { GetKiloName, Digit } from '../../common'
- import NAMES from './names'
- import getKiloCombiningPrefix from './base/kilo/combiningPrefix'
-
- const getKiloName: GetKiloName = (thousandPower) => {
- if (thousandPower === 0n) {
- return ''
- }
- if (thousandPower === 1n) {
- return NAMES.thousand
- }
- const kilo = thousandPower - 1n
- const kiloHundreds = kilo / 100n
- const kiloTens = (Number(kilo / 10n) % 10) as Digit
- const kiloOnes = (Number(kilo) % 10) as Digit
-
- return getKiloCombiningPrefix(kiloHundreds, kiloTens, kiloOnes) + NAMES.kiloEvenSuffix
- }
-
- export default getKiloName
|