Comparing version 2.2.2 to 2.2.3
@@ -5,2 +5,4 @@ # Changelog | ||
### [2.2.3](https://github.com/mastermunj/to-words/compare/v2.2.2...v2.2.3) (2020-09-25) | ||
### [2.2.2](https://github.com/mastermunj/to-words/compare/v2.2.1...v2.2.2) (2020-09-22) | ||
@@ -7,0 +9,0 @@ |
{ | ||
"name": "to-words", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "Converts numbers (including decimal points) into words & currency.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -39,4 +39,13 @@ import { LocaleInterface } from './locales/locale.interface'; | ||
private getLocaleClass(): ConstructorOf<LocaleInterface> { | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
return require(`./locales/${this.options.localeCode}`).Locale; | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
switch (this.options.localeCode) { | ||
case 'en-IN': | ||
return require('./locales/en-IN').Locale; | ||
case 'en-MU': | ||
return require('./locales/en-MU').Locale; | ||
case 'en-US': | ||
return require('./locales/en-US').Locale; | ||
} | ||
/* eslint-enable @typescript-eslint/no-var-requires */ | ||
throw new Error(`Unknown Locale "${this.options.localeCode}"`); | ||
} | ||
@@ -46,8 +55,4 @@ | ||
if (this.locale === undefined) { | ||
try { | ||
const LocaleClass = this.getLocaleClass(); | ||
this.locale = new LocaleClass(); | ||
} catch (e) { | ||
throw new Error(`Unknown Locale "${this.options.localeCode}"`); | ||
} | ||
const LocaleClass = this.getLocaleClass(); | ||
this.locale = new LocaleClass(); | ||
} | ||
@@ -54,0 +59,0 @@ return this.locale as LocaleInterface; |
Sorry, the diff of this file is not supported yet
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
56104
1461