|
|
@@ -11,6 +11,9 @@ const NEGATIVE = 'negative' as const; |
|
|
|
|
|
|
|
const NEGATIVE_SYMBOL = '-' as const; |
|
|
|
|
|
|
|
// replace with hyphen with option |
|
|
|
const TENS_ONES_SEPARATOR = ' ' as const; |
|
|
|
|
|
|
|
const POSITIVE_SYMBOL = '+' as const; |
|
|
|
|
|
|
|
const SHORT_MILLIA_DELIMITER = '^' as const; |
|
|
@@ -190,7 +193,7 @@ const makeTensName = (tens: number, ones: number) => { |
|
|
|
return TENS[tens]; |
|
|
|
} |
|
|
|
|
|
|
|
return `${TENS[tens] as Exclude<TensName, 'zero' | 'ten'>} ${ONES[ones] as Exclude<OnesName, 'zero'>}` as const; |
|
|
|
return `${TENS[tens] as Exclude<TensName, 'zero' | 'ten'>}${TENS_ONES_SEPARATOR}${ONES[ones] as Exclude<OnesName, 'zero'>}` as const; |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
@@ -409,7 +412,10 @@ export const makeNegative = (s: string) => ( |
|
|
|
); |
|
|
|
|
|
|
|
export const tokenize = (stringValue: string) => ( |
|
|
|
stringValue.split(' ').filter((maybeToken) => maybeToken.length > 0) |
|
|
|
stringValue |
|
|
|
.replace(new RegExp(`${TENS_ONES_SEPARATOR}`, 'g'), ' ') |
|
|
|
.split(' ') |
|
|
|
.filter((maybeToken) => maybeToken.length > 0) |
|
|
|
); |
|
|
|
|
|
|
|
const FINAL_TOKEN = '' as const; |
|
|
|