Get the name of a number, even if it's stupidly big.
Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
Это архивный репозиторий. Вы можете его клонировать или просматривать файлы, но не вносить изменения или открывать задачи/запросы на слияние.
|
- 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
|