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 NAMES from './names.json'
-
- interface GetBaseHundredUnit {
- (hundreds: number): string
- }
-
- const getBaseHundredUnit: GetBaseHundredUnit = hundreds => {
- let hundredsUnit = NAMES.base.units[hundreds]
- const hundredsSuffix = NAMES.hundred
- const unitLastCharacter = hundredsUnit.slice(-1)
- switch (unitLastCharacter) {
- case 't':
- case 'm':
- return hundredsUnit + 'nar' + hundredsSuffix.slice(1)
- case 'a':
- if (hundredsUnit.startsWith('i')) {
- hundredsUnit = hundredsUnit.slice(1)
- }
- return hundredsUnit + 'n' + hundredsSuffix
- case 'o':
- default:
- break
- }
-
- return hundredsUnit + 'ng' + hundredsSuffix
- }
-
- export default getBaseHundredUnit
|