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.
|
- import { Digit } from '../../../common'
- import ones from '../base/ones'
- import tenPlus from '../base/tenPlus'
- import getBaseTenTimesName from '../base/tenTimes'
-
- interface Tens {
- (x10: Digit, x1: Digit): string
- }
-
- const tens: Tens = (x10, x1) => {
- switch (x10) {
- case 0:
- return ones(x1)
- case 1:
- if (x1 > 0) {
- return tenPlus(x1)
- }
- break
- default:
- break
- }
-
- return x1 > 0 ? [getBaseTenTimesName(x10), ones(x1)].join(' ') : getBaseTenTimesName(x10)
- }
-
- export default tens
|