Comparing version 4.0.1 to 4.1.0
@@ -5,2 +5,17 @@ # Changelog | ||
## [4.1.0](https://github.com/mastermunj/to-words/compare/v4.0.1...v4.1.0) (2024-07-17) | ||
### Features | ||
* expose locales in an iterable capacity ([cb7b8cf](https://github.com/mastermunj/to-words/commit/cb7b8cfed2b9d728eb08383bfcd79f2332825a4a)) | ||
* **locales:** spanish support added ([20b7aa6](https://github.com/mastermunj/to-words/commit/20b7aa6c0f11480d314c0a1933aaed0635387d23)) | ||
### Bug Fixes | ||
* add optional trailing variant to exactWordsMapping ([44fd000](https://github.com/mastermunj/to-words/commit/44fd000f193f0b9ac5409cbeaf453c026261c66e)) | ||
* annotate types of test macro entries properly ([37c7768](https://github.com/mastermunj/to-words/commit/37c7768a8e2194fdbfb3dbc6398c5964d0c9b404)) | ||
* use singular field of `CurrencyOptions` ([566ae94](https://github.com/mastermunj/to-words/commit/566ae94c7cb6e2a03daa11693fdddafdb3057963)) | ||
### [4.0.1](https://github.com/mastermunj/to-words/compare/v4.0.0...v4.0.1) (2024-03-12) | ||
@@ -7,0 +22,0 @@ |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
import { ConstructorOf, ConverterOptions, LocaleInterface, ToWordsOptions } from './types'; | ||
import LOCALES from './locales'; | ||
export { LOCALES }; | ||
export declare const DefaultConverterOptions: ConverterOptions; | ||
export declare const DefaultToWordsOptions: ToWordsOptions; | ||
export declare class ToWords { | ||
private options; | ||
private locale; | ||
constructor(options?: ToWordsOptions); | ||
getLocaleClass(): ConstructorOf<LocaleInterface>; | ||
getLocale(): InstanceType<ConstructorOf<LocaleInterface>>; | ||
convert(number: number, options?: ConverterOptions): string; | ||
protected convertNumber(number: number): string[]; | ||
protected convertCurrency(number: number, options?: ConverterOptions): string[]; | ||
protected convertInternal(number: number): string[]; | ||
toFixed(number: number, precision?: number): number; | ||
isFloat(number: number | string): boolean; | ||
isValidNumber(number: number | string): boolean; | ||
isNumberZero(number: number): boolean; | ||
private options; | ||
private locale; | ||
constructor(options?: ToWordsOptions); | ||
getLocaleClass(): ConstructorOf<LocaleInterface>; | ||
getLocale(): InstanceType<ConstructorOf<LocaleInterface>>; | ||
convert(number: number, options?: ConverterOptions): string; | ||
protected convertNumber(number: number): string[]; | ||
protected convertCurrency(number: number, options?: ConverterOptions): string[]; | ||
protected convertInternal(number: number, trailing?: boolean): string[]; | ||
toFixed(number: number, precision?: number): number; | ||
isFloat(number: number | string): boolean; | ||
isValidNumber(number: number | string): boolean; | ||
isNumberZero(number: number): boolean; | ||
} |
@@ -6,26 +6,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ToWords = exports.DefaultToWordsOptions = exports.DefaultConverterOptions = void 0; | ||
const en_AE_1 = __importDefault(require("./locales/en-AE")); | ||
const en_BD_1 = __importDefault(require("./locales/en-BD")); | ||
const en_GH_1 = __importDefault(require("./locales/en-GH")); | ||
const en_IE_1 = __importDefault(require("./locales/en-IE")); | ||
const en_IN_1 = __importDefault(require("./locales/en-IN")); | ||
const en_MM_1 = __importDefault(require("./locales/en-MM")); | ||
const en_MU_1 = __importDefault(require("./locales/en-MU")); | ||
const en_NG_1 = __importDefault(require("./locales/en-NG")); | ||
const en_NP_1 = __importDefault(require("./locales/en-NP")); | ||
const en_US_1 = __importDefault(require("./locales/en-US")); | ||
const en_GB_1 = __importDefault(require("./locales/en-GB")); | ||
const en_PH_1 = __importDefault(require("./locales/en-PH")); | ||
const fa_IR_1 = __importDefault(require("./locales/fa-IR")); | ||
const fr_BE_1 = __importDefault(require("./locales/fr-BE")); | ||
const fr_FR_1 = __importDefault(require("./locales/fr-FR")); | ||
const gu_IN_1 = __importDefault(require("./locales/gu-IN")); | ||
const hi_IN_1 = __importDefault(require("./locales/hi-IN")); | ||
const mr_IN_1 = __importDefault(require("./locales/mr-IN")); | ||
const pt_BR_1 = __importDefault(require("./locales/pt-BR")); | ||
const tr_TR_1 = __importDefault(require("./locales/tr-TR")); | ||
const nl_SR_1 = __importDefault(require("./locales/nl-SR")); | ||
const ee_EE_1 = __importDefault(require("./locales/ee-EE")); | ||
const ko_KR_1 = __importDefault(require("./locales/ko-KR")); | ||
exports.ToWords = exports.DefaultToWordsOptions = exports.DefaultConverterOptions = exports.LOCALES = void 0; | ||
const locales_1 = __importDefault(require("./locales")); | ||
exports.LOCALES = locales_1.default; | ||
exports.DefaultConverterOptions = { | ||
@@ -48,53 +27,7 @@ currency: false, | ||
getLocaleClass() { | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
switch (this.options.localeCode) { | ||
case 'ee-EE': | ||
return ee_EE_1.default; | ||
case 'en-AE': | ||
return en_AE_1.default; | ||
case 'en-BD': | ||
return en_BD_1.default; | ||
case 'en-GH': | ||
return en_GH_1.default; | ||
case 'en-IE': | ||
return en_IE_1.default; | ||
case 'en-IN': | ||
return en_IN_1.default; | ||
case 'en-MM': | ||
return en_MM_1.default; | ||
case 'en-MU': | ||
return en_MU_1.default; | ||
case 'en-NG': | ||
return en_NG_1.default; | ||
case 'en-NP': | ||
return en_NP_1.default; | ||
case 'en-US': | ||
return en_US_1.default; | ||
case 'en-GB': | ||
return en_GB_1.default; | ||
case 'en-PH': | ||
return en_PH_1.default; | ||
case 'fa-IR': | ||
return fa_IR_1.default; | ||
case 'fr-BE': | ||
return fr_BE_1.default; | ||
case 'fr-FR': | ||
return fr_FR_1.default; | ||
case 'gu-IN': | ||
return gu_IN_1.default; | ||
case 'hi-IN': | ||
return hi_IN_1.default; | ||
case 'mr-IN': | ||
return mr_IN_1.default; | ||
case 'pt-BR': | ||
return pt_BR_1.default; | ||
case 'tr-TR': | ||
return tr_TR_1.default; | ||
case 'nl-SR': | ||
return nl_SR_1.default; | ||
case 'ko-KR': | ||
return ko_KR_1.default; | ||
if (!(this.options.localeCode in locales_1.default)) { | ||
/* eslint-enable @typescript-eslint/no-var-requires */ | ||
throw new Error(`Unknown Locale "${this.options.localeCode}"`); | ||
} | ||
/* eslint-enable @typescript-eslint/no-var-requires */ | ||
throw new Error(`Unknown Locale "${this.options.localeCode}"`); | ||
return locales_1.default[this.options.localeCode]; | ||
} | ||
@@ -138,3 +71,3 @@ getLocale() { | ||
const ignoreZero = this.isNumberZero(number) && locale.config.ignoreZeroInDecimals; | ||
let words = this.convertInternal(Number(split[0])); | ||
let words = this.convertInternal(Number(split[0]), true); | ||
const isFloat = this.isFloat(number); | ||
@@ -152,3 +85,3 @@ if (isFloat && ignoreZero) { | ||
for (const num of split[1]) { | ||
zeroWords.push(...this.convertInternal(Number(num))); | ||
zeroWords.push(...this.convertInternal(Number(num), true)); | ||
} | ||
@@ -158,3 +91,3 @@ wordsWithDecimal.push(...zeroWords); | ||
else { | ||
wordsWithDecimal.push(...this.convertInternal(Number(split[1]))); | ||
wordsWithDecimal.push(...this.convertInternal(Number(split[1]), true)); | ||
const decimalLengthWord = (_c = (_b = locale.config) === null || _b === void 0 ? void 0 : _b.decimalLengthWordMapping) === null || _c === void 0 ? void 0 : _c[split[1].length]; | ||
@@ -188,3 +121,3 @@ if (decimalLengthWord) { | ||
if (Number(split[0]) === 1 && currencyOptions.singular) { | ||
words.push(currencyOptions.name); | ||
words.push(currencyOptions.singular); | ||
} | ||
@@ -238,3 +171,3 @@ else if (currencyOptions.plural) { | ||
} | ||
convertInternal(number) { | ||
convertInternal(number, trailing = false) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; | ||
@@ -247,3 +180,3 @@ const locale = this.getLocale(); | ||
if (exactMatch) { | ||
return [exactMatch.value]; | ||
return [Array.isArray(exactMatch.value) ? exactMatch.value[+trailing] : exactMatch.value]; | ||
} | ||
@@ -256,3 +189,3 @@ } | ||
if (number <= 100 || (number < 1000 && locale.config.namedLessThan1000)) { | ||
words.push(match.value); | ||
words.push(Array.isArray(match.value) ? match.value[0] : match.value); | ||
number -= match.number; | ||
@@ -263,3 +196,3 @@ if (number > 0) { | ||
} | ||
words.push(...this.convertInternal(number)); | ||
words.push(...this.convertInternal(number, trailing)); | ||
} | ||
@@ -274,7 +207,8 @@ return words; | ||
} | ||
if (quotient === 1 && ((_j = (_h = locale.config) === null || _h === void 0 ? void 0 : _h.ignoreOneForWords) === null || _j === void 0 ? void 0 : _j.includes(matchValue))) { | ||
words.push(matchValue); | ||
if (quotient === 1 && | ||
((_j = (_h = locale.config) === null || _h === void 0 ? void 0 : _h.ignoreOneForWords) === null || _j === void 0 ? void 0 : _j.includes(Array.isArray(matchValue) ? matchValue[0] : matchValue))) { | ||
words.push(Array.isArray(matchValue) ? matchValue[1] : matchValue); | ||
} | ||
else { | ||
words.push(...this.convertInternal(quotient), matchValue); | ||
words.push(...this.convertInternal(quotient, false), Array.isArray(matchValue) ? matchValue[0] : matchValue); | ||
} | ||
@@ -287,3 +221,3 @@ if (remainder > 0) { | ||
} | ||
words.push(...this.convertInternal(remainder)); | ||
words.push(...this.convertInternal(remainder, trailing)); | ||
} | ||
@@ -290,0 +224,0 @@ return words; |
export interface CurrencyOptions { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
singular?: string; | ||
fractionalUnit: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
singular?: string; | ||
symbol: string; | ||
}; | ||
fractionalUnit: { | ||
name: string; | ||
plural: string; | ||
singular?: string; | ||
symbol: string; | ||
}; | ||
} | ||
export type ConverterOptions = { | ||
currency?: boolean; | ||
ignoreDecimal?: boolean; | ||
ignoreZeroCurrency?: boolean; | ||
doNotAddOnly?: boolean; | ||
currencyOptions?: CurrencyOptions; | ||
currency?: boolean; | ||
ignoreDecimal?: boolean; | ||
ignoreZeroCurrency?: boolean; | ||
doNotAddOnly?: boolean; | ||
currencyOptions?: CurrencyOptions; | ||
}; | ||
export type ToWordsOptions = { | ||
localeCode?: string; | ||
converterOptions?: ConverterOptions; | ||
localeCode?: string; | ||
converterOptions?: ConverterOptions; | ||
}; | ||
export interface ConstructorOf<T> { | ||
new (...args: unknown[]): T; | ||
new (...args: unknown[]): T; | ||
} | ||
export type NumberWordMap = { | ||
number: number; | ||
value: string; | ||
number: number; | ||
value: string | [string, string]; | ||
}; | ||
export type LocaleConfig = { | ||
currency: CurrencyOptions; | ||
texts: { | ||
and: string; | ||
minus: string; | ||
only: string; | ||
point: string; | ||
}; | ||
numberWordsMapping: NumberWordMap[]; | ||
exactWordsMapping?: NumberWordMap[]; | ||
namedLessThan1000?: boolean; | ||
splitWord?: string; | ||
ignoreZeroInDecimals?: boolean; | ||
decimalLengthWordMapping?: Record<number, string>; | ||
ignoreOneForWords?: string[]; | ||
pluralMark?: string; | ||
pluralWords?: string[]; | ||
noSplitWordAfter?: string[]; | ||
onlyInFront?: boolean; | ||
trim?: boolean; | ||
currency: CurrencyOptions; | ||
texts: { | ||
and: string; | ||
minus: string; | ||
only: string; | ||
point: string; | ||
}; | ||
numberWordsMapping: NumberWordMap[]; | ||
exactWordsMapping?: NumberWordMap[]; | ||
namedLessThan1000?: boolean; | ||
splitWord?: string; | ||
ignoreZeroInDecimals?: boolean; | ||
decimalLengthWordMapping?: Record<number, string>; | ||
ignoreOneForWords?: string[]; | ||
pluralMark?: string; | ||
pluralWords?: string[]; | ||
noSplitWordAfter?: string[]; | ||
onlyInFront?: boolean; | ||
trim?: boolean; | ||
}; | ||
export interface LocaleInterface { | ||
config: LocaleConfig; | ||
config: LocaleConfig; | ||
} |
{ | ||
"name": "to-words", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "Converts numbers (including decimal points) into words & currency.", | ||
@@ -56,3 +56,3 @@ "keywords": [ | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-jest": "^27.9.0", | ||
"eslint-plugin-jest": "^28.2.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
@@ -64,3 +64,3 @@ "husky": "^9.0.11", | ||
"prettier": "^3.2.5", | ||
"rimraf": "^5.0.5", | ||
"rimraf": "^6.0.0", | ||
"sort-package-json": "^1.57.0", | ||
@@ -67,0 +67,0 @@ "source-map-support": "^0.5.21", |
import { ConstructorOf, ConverterOptions, LocaleInterface, NumberWordMap, ToWordsOptions } from './types'; | ||
import enAe from './locales/en-AE'; | ||
import enBd from './locales/en-BD'; | ||
import enGh from './locales/en-GH'; | ||
import enIe from './locales/en-IE'; | ||
import enIn from './locales/en-IN'; | ||
import enMm from './locales/en-MM'; | ||
import enMu from './locales/en-MU'; | ||
import enNg from './locales/en-NG'; | ||
import enNp from './locales/en-NP'; | ||
import enUs from './locales/en-US'; | ||
import enGb from './locales/en-GB'; | ||
import enPh from './locales/en-PH'; | ||
import faIr from './locales/fa-IR'; | ||
import frBe from './locales/fr-BE'; | ||
import frFr from './locales/fr-FR'; | ||
import guIn from './locales/gu-IN'; | ||
import hiIn from './locales/hi-IN'; | ||
import mrIn from './locales/mr-IN'; | ||
import ptBR from './locales/pt-BR'; | ||
import trTr from './locales/tr-TR'; | ||
import nlSr from './locales/nl-SR'; | ||
import eeEE from './locales/ee-EE'; | ||
import koKr from './locales/ko-KR'; | ||
import LOCALES from './locales'; | ||
export { LOCALES }; | ||
export const DefaultConverterOptions: ConverterOptions = { | ||
@@ -48,53 +28,7 @@ currency: false, | ||
public getLocaleClass(): ConstructorOf<LocaleInterface> { | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
switch (this.options.localeCode) { | ||
case 'ee-EE': | ||
return eeEE; | ||
case 'en-AE': | ||
return enAe; | ||
case 'en-BD': | ||
return enBd; | ||
case 'en-GH': | ||
return enGh; | ||
case 'en-IE': | ||
return enIe; | ||
case 'en-IN': | ||
return enIn; | ||
case 'en-MM': | ||
return enMm; | ||
case 'en-MU': | ||
return enMu; | ||
case 'en-NG': | ||
return enNg; | ||
case 'en-NP': | ||
return enNp; | ||
case 'en-US': | ||
return enUs; | ||
case 'en-GB': | ||
return enGb; | ||
case 'en-PH': | ||
return enPh; | ||
case 'fa-IR': | ||
return faIr; | ||
case 'fr-BE': | ||
return frBe; | ||
case 'fr-FR': | ||
return frFr; | ||
case 'gu-IN': | ||
return guIn; | ||
case 'hi-IN': | ||
return hiIn; | ||
case 'mr-IN': | ||
return mrIn; | ||
case 'pt-BR': | ||
return ptBR; | ||
case 'tr-TR': | ||
return trTr; | ||
case 'nl-SR': | ||
return nlSr; | ||
case 'ko-KR': | ||
return koKr; | ||
if (!(this.options.localeCode! in LOCALES)) { | ||
/* eslint-enable @typescript-eslint/no-var-requires */ | ||
throw new Error(`Unknown Locale "${this.options.localeCode}"`); | ||
} | ||
/* eslint-enable @typescript-eslint/no-var-requires */ | ||
throw new Error(`Unknown Locale "${this.options.localeCode}"`); | ||
return LOCALES[this.options.localeCode!]; | ||
} | ||
@@ -145,3 +79,3 @@ | ||
const ignoreZero = this.isNumberZero(number) && locale.config.ignoreZeroInDecimals; | ||
let words = this.convertInternal(Number(split[0])); | ||
let words = this.convertInternal(Number(split[0]), true); | ||
const isFloat = this.isFloat(number); | ||
@@ -159,7 +93,7 @@ if (isFloat && ignoreZero) { | ||
for (const num of split[1]) { | ||
zeroWords.push(...this.convertInternal(Number(num))); | ||
zeroWords.push(...this.convertInternal(Number(num), true)); | ||
} | ||
wordsWithDecimal.push(...zeroWords); | ||
} else { | ||
wordsWithDecimal.push(...this.convertInternal(Number(split[1]))); | ||
wordsWithDecimal.push(...this.convertInternal(Number(split[1]), true)); | ||
const decimalLengthWord = locale.config?.decimalLengthWordMapping?.[split[1].length]; | ||
@@ -197,3 +131,3 @@ if (decimalLengthWord) { | ||
if (Number(split[0]) === 1 && currencyOptions.singular) { | ||
words.push(currencyOptions.name); | ||
words.push(currencyOptions.singular); | ||
} else if (currencyOptions.plural) { | ||
@@ -251,3 +185,3 @@ words.push(currencyOptions.plural); | ||
protected convertInternal(number: number): string[] { | ||
protected convertInternal(number: number, trailing: boolean = false): string[] { | ||
const locale = this.getLocale(); | ||
@@ -260,3 +194,3 @@ | ||
if (exactMatch) { | ||
return [exactMatch.value]; | ||
return [Array.isArray(exactMatch.value) ? exactMatch.value[+trailing] : exactMatch.value]; | ||
} | ||
@@ -271,3 +205,3 @@ } | ||
if (number <= 100 || (number < 1000 && locale.config.namedLessThan1000)) { | ||
words.push(match.value); | ||
words.push(Array.isArray(match.value) ? match.value[0] : match.value); | ||
number -= match.number; | ||
@@ -278,3 +212,3 @@ if (number > 0) { | ||
} | ||
words.push(...this.convertInternal(number)); | ||
words.push(...this.convertInternal(number, trailing)); | ||
} | ||
@@ -290,6 +224,9 @@ return words; | ||
} | ||
if (quotient === 1 && locale.config?.ignoreOneForWords?.includes(matchValue)) { | ||
words.push(matchValue); | ||
if ( | ||
quotient === 1 && | ||
locale.config?.ignoreOneForWords?.includes(Array.isArray(matchValue) ? matchValue[0] : matchValue) | ||
) { | ||
words.push(Array.isArray(matchValue) ? matchValue[1] : matchValue); | ||
} else { | ||
words.push(...this.convertInternal(quotient), matchValue); | ||
words.push(...this.convertInternal(quotient, false), Array.isArray(matchValue) ? matchValue[0] : matchValue); | ||
} | ||
@@ -303,3 +240,3 @@ | ||
} | ||
words.push(...this.convertInternal(remainder)); | ||
words.push(...this.convertInternal(remainder, trailing)); | ||
} | ||
@@ -306,0 +243,0 @@ return words; |
@@ -33,3 +33,3 @@ export interface CurrencyOptions { | ||
number: number; | ||
value: string; | ||
value: string | [string, string]; | ||
}; | ||
@@ -36,0 +36,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
441844
127
10491