Get the name of a number, even if it's stupidly big.
No puede seleccionar más de 25 temas
Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
Este repositorio está archivado. Puede ver los archivos y clonarlo, pero no puede subir cambios o reportar incidencias ni pedir Pull Requests.
|
- import { GetKiloName } from '../../NumberSystem'
- import NAMES from './names.json'
- import getKiloCombiningPrefix from './base/kilo/combiningPrefix'
-
- const getKiloName: GetKiloName = (thousandPower) => {
- if (thousandPower === 0) {
- return ''
- }
- if (thousandPower === 1) {
- return NAMES.thousand
- }
- const kilo = thousandPower - 1
- const kiloHundreds = Math.floor(kilo / 100)
- const kiloTens = Math.floor((kilo / 10) % 10)
- const kiloOnes = Math.floor(kilo % 10)
-
- return getKiloCombiningPrefix(kiloHundreds, kiloTens, kiloOnes) + NAMES.kiloEvenSuffix
- }
-
- export default getKiloName
|