Comparing version 2.5.0 to 3.0.0-alpha.0
@@ -1,8 +0,24 @@ | ||
import { ToWords } from '../src/to-words'; | ||
import cloneDeep from 'lodash/cloneDeep'; | ||
import { cloneDeep } from 'lodash'; | ||
import { ToWords } from '../src/ToWords'; | ||
import enGh from '../src/locales/en-GH'; | ||
const localeCode = 'en-GH'; | ||
const toWords = new ToWords({ | ||
localeCode: 'en-GH', | ||
localeCode, | ||
}); | ||
describe('Test Locale', () => { | ||
test(`Locale Class: ${localeCode}`, () => { | ||
expect(toWords.getLocaleClass()).toBe(enGh); | ||
}); | ||
const wrongLocaleCode = localeCode + '-wrong'; | ||
test(`Wrong Locale: ${wrongLocaleCode}`, () => { | ||
const toWordsWrongLocale = new ToWords({ | ||
localeCode: wrongLocaleCode, | ||
}); | ||
expect(() => toWordsWrongLocale.convert(1)).toThrow(/Unknown Locale/); | ||
}); | ||
}); | ||
const testIntegers = [ | ||
@@ -12,4 +28,6 @@ [0, 'Zero'], | ||
[700, 'Seven Hundred'], | ||
[1100, 'One Thousand One Hundred'], | ||
[4680, 'Four Thousand Six Hundred Eighty'], | ||
[63892, 'Sixty Three Thousand Eight Hundred Ninety Two'], | ||
[86100, 'Eighty Six Thousand One Hundred'], | ||
[792581, 'Seven Hundred Ninety Two Thousand Five Hundred Eighty One'], | ||
@@ -39,3 +57,3 @@ [2741034, 'Two Million Seven Hundred Forty One Thousand Thirty Four'], | ||
describe('Test Integers with options = {}', () => { | ||
test.each(testIntegers)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testIntegers)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -45,13 +63,13 @@ }); | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
test.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -61,9 +79,25 @@ }); | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Cedis Only`; | ||
describe('Test Integers with options = { currency: true }', () => { | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Cedis Only`; | ||
}); | ||
test.concurrent.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
}); | ||
}); | ||
describe('Test Integers with options = { currency: true }', () => { | ||
test.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
describe('Test Negative Integers with options = { currency: true }', () => { | ||
const testNegativeIntegersWithCurrency = cloneDeep(testIntegers); | ||
testNegativeIntegersWithCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = `${row[1]} Cedis Only`; | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]} Cedis Only`; | ||
}); | ||
test.concurrent.each(testNegativeIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
@@ -73,7 +107,9 @@ }); | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegersWithCurrency); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
row[1] = i === 0 ? '' : `${row[1]} Cedis Only`; | ||
}); | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -103,3 +139,3 @@ toWords.convert(input as number, { | ||
describe('Test Floats with options = {}', () => { | ||
test.each(testFloats)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloats)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -111,16 +147,16 @@ }); | ||
[0.0, `Zero Cedis Only`], | ||
[0.04, `Zero Cedis And Four Pasewas Only`], | ||
[0.0468, `Zero Cedis And Five Pasewas Only`], | ||
[0.4, `Zero Cedis And Forty Pasewas Only`], | ||
[0.63, `Zero Cedis And Sixty Three Pasewas Only`], | ||
[0.973, `Zero Cedis And Ninety Seven Pasewas Only`], | ||
[0.04, `Zero Cedis And Four Pesewas Only`], | ||
[0.0468, `Zero Cedis And Five Pesewas Only`], | ||
[0.4, `Zero Cedis And Forty Pesewas Only`], | ||
[0.63, `Zero Cedis And Sixty Three Pesewas Only`], | ||
[0.973, `Zero Cedis And Ninety Seven Pesewas Only`], | ||
[0.999, `One Cedis Only`], | ||
[37.06, `Thirty Seven Cedis And Six Pasewas Only`], | ||
[37.068, `Thirty Seven Cedis And Seven Pasewas Only`], | ||
[37.68, `Thirty Seven Cedis And Sixty Eight Pasewas Only`], | ||
[37.683, `Thirty Seven Cedis And Sixty Eight Pasewas Only`], | ||
[37.06, `Thirty Seven Cedis And Six Pesewas Only`], | ||
[37.068, `Thirty Seven Cedis And Seven Pesewas Only`], | ||
[37.68, `Thirty Seven Cedis And Sixty Eight Pesewas Only`], | ||
[37.683, `Thirty Seven Cedis And Sixty Eight Pesewas Only`], | ||
]; | ||
describe('Test Floats with options = { currency: true }', () => { | ||
test.each(testFloatsWithCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
@@ -130,16 +166,16 @@ }); | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zero Cedis And `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zero Cedis And `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -154,13 +190,13 @@ toWords.convert(input as number, { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zero Cedis Only`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Pasewas`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zero Cedis Only`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Pesewas`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -175,21 +211,24 @@ toWords.convert(input as number, { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Pasewas`), ''); | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)('convert %d => %s', (input, expected) => { | ||
expect( | ||
toWords.convert(input as number, { | ||
currency: true, | ||
ignoreZeroCurrency: true, | ||
ignoreDecimal: true, | ||
}), | ||
).toBe(expected); | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Pesewas`), ''); | ||
}); | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)( | ||
'convert %d => %s', | ||
(input, expected) => { | ||
expect( | ||
toWords.convert(input as number, { | ||
currency: true, | ||
ignoreZeroCurrency: true, | ||
ignoreDecimal: true, | ||
}), | ||
).toBe(expected); | ||
}, | ||
); | ||
}); |
@@ -1,8 +0,24 @@ | ||
import { ToWords } from '../src/to-words'; | ||
import cloneDeep from 'lodash/cloneDeep'; | ||
import { cloneDeep } from 'lodash'; | ||
import { ToWords } from '../src/ToWords'; | ||
import enIn from '../src/locales/en-IN'; | ||
const localeCode = 'en-IN'; | ||
const toWords = new ToWords({ | ||
localeCode: 'en-IN', | ||
localeCode, | ||
}); | ||
describe('Test Locale', () => { | ||
test(`Locale Class: ${localeCode}`, () => { | ||
expect(toWords.getLocaleClass()).toBe(enIn); | ||
}); | ||
const wrongLocaleCode = localeCode + '-wrong'; | ||
test(`Wrong Locale: ${wrongLocaleCode}`, () => { | ||
const toWordsWrongLocale = new ToWords({ | ||
localeCode: wrongLocaleCode, | ||
}); | ||
expect(() => toWordsWrongLocale.convert(1)).toThrow(/Unknown Locale/); | ||
}); | ||
}); | ||
const testIntegers = [ | ||
@@ -12,4 +28,6 @@ [0, 'Zero'], | ||
[700, 'Seven Hundred'], | ||
[1100, 'One Thousand One Hundred'], | ||
[4680, 'Four Thousand Six Hundred Eighty'], | ||
[63892, 'Sixty Three Thousand Eight Hundred Ninety Two'], | ||
[86100, 'Eighty Six Thousand One Hundred'], | ||
[792581, 'Seven Lakh Ninety Two Thousand Five Hundred Eighty One'], | ||
@@ -33,3 +51,3 @@ [2741034, 'Twenty Seven Lakh Forty One Thousand Thirty Four'], | ||
describe('Test Integers with options = {}', () => { | ||
test.each(testIntegers)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testIntegers)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -39,13 +57,13 @@ }); | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
test.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -55,9 +73,25 @@ }); | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Rupees Only`; | ||
describe('Test Integers with options = { currency: true }', () => { | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Rupees Only`; | ||
}); | ||
test.concurrent.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
}); | ||
}); | ||
describe('Test Integers with options = { currency: true }', () => { | ||
test.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
describe('Test Negative Integers with options = { currency: true }', () => { | ||
const testNegativeIntegersWithCurrency = cloneDeep(testIntegers); | ||
testNegativeIntegersWithCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = `${row[1]} Rupees Only`; | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]} Rupees Only`; | ||
}); | ||
test.concurrent.each(testNegativeIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
@@ -67,7 +101,9 @@ }); | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegersWithCurrency); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
row[1] = i === 0 ? '' : `${row[1]} Rupees Only`; | ||
}); | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -97,3 +133,3 @@ toWords.convert(input as number, { | ||
describe('Test Floats with options = {}', () => { | ||
test.each(testFloats)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloats)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -118,3 +154,3 @@ }); | ||
describe('Test Floats with options = { currency: true }', () => { | ||
test.each(testFloatsWithCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
@@ -124,16 +160,16 @@ }); | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zero Rupees And `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zero Rupees And `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -148,13 +184,13 @@ toWords.convert(input as number, { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zero Rupees Only`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Paise`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zero Rupees Only`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Paise`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -169,21 +205,24 @@ toWords.convert(input as number, { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Paise`), ''); | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)('convert %d => %s', (input, expected) => { | ||
expect( | ||
toWords.convert(input as number, { | ||
currency: true, | ||
ignoreZeroCurrency: true, | ||
ignoreDecimal: true, | ||
}), | ||
).toBe(expected); | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Paise`), ''); | ||
}); | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)( | ||
'convert %d => %s', | ||
(input, expected) => { | ||
expect( | ||
toWords.convert(input as number, { | ||
currency: true, | ||
ignoreZeroCurrency: true, | ||
ignoreDecimal: true, | ||
}), | ||
).toBe(expected); | ||
}, | ||
); | ||
}); |
@@ -1,8 +0,24 @@ | ||
import { ToWords } from '../src/to-words'; | ||
import cloneDeep from 'lodash/cloneDeep'; | ||
import { cloneDeep } from 'lodash'; | ||
import { ToWords } from '../src/ToWords'; | ||
import enMm from '../src/locales/en-MM'; | ||
const localeCode = 'en-MM'; | ||
const toWords = new ToWords({ | ||
localeCode: 'en-MM', | ||
localeCode, | ||
}); | ||
describe('Test Locale', () => { | ||
test(`Locale Class: ${localeCode}`, () => { | ||
expect(toWords.getLocaleClass()).toBe(enMm); | ||
}); | ||
const wrongLocaleCode = localeCode + '-wrong'; | ||
test(`Wrong Locale: ${wrongLocaleCode}`, () => { | ||
const toWordsWrongLocale = new ToWords({ | ||
localeCode: wrongLocaleCode, | ||
}); | ||
expect(() => toWordsWrongLocale.convert(1)).toThrow(/Unknown Locale/); | ||
}); | ||
}); | ||
const testIntegers = [ | ||
@@ -12,4 +28,6 @@ [0, 'Zero'], | ||
[700, 'Seven Hundred'], | ||
[1100, 'One Thousand One Hundred'], | ||
[4680, 'Four Thousand Six Hundred Eighty'], | ||
[63892, 'Sixty Three Thousand Eight Hundred Ninety Two'], | ||
[86100, 'Eighty Six Thousand One Hundred'], | ||
[792581, 'Seven Hundred Ninety Two Thousand Five Hundred Eighty One'], | ||
@@ -39,3 +57,3 @@ [2741034, 'Two Million Seven Hundred Forty One Thousand Thirty Four'], | ||
describe('Test Integers with options = {}', () => { | ||
test.each(testIntegers)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testIntegers)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -45,13 +63,13 @@ }); | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
test.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -61,9 +79,25 @@ }); | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Kyats Only`; | ||
describe('Test Integers with options = { currency: true }', () => { | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Kyats Only`; | ||
}); | ||
test.concurrent.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
}); | ||
}); | ||
describe('Test Integers with options = { currency: true }', () => { | ||
test.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
describe('Test Negative Integers with options = { currency: true }', () => { | ||
const testNegativeIntegersWithCurrency = cloneDeep(testIntegers); | ||
testNegativeIntegersWithCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = `${row[1]} Kyats Only`; | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]} Kyats Only`; | ||
}); | ||
test.concurrent.each(testNegativeIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
@@ -73,7 +107,9 @@ }); | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegersWithCurrency); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
row[1] = i === 0 ? '' : `${row[1]} Kyats Only`; | ||
}); | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -103,3 +139,3 @@ toWords.convert(input as number, { | ||
describe('Test Floats with options = {}', () => { | ||
test.each(testFloats)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloats)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -124,3 +160,3 @@ }); | ||
describe('Test Floats with options = { currency: true }', () => { | ||
test.each(testFloatsWithCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
@@ -130,16 +166,16 @@ }); | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zero Kyats And `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zero Kyats And `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -154,13 +190,13 @@ toWords.convert(input as number, { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zero Kyats Only`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Pyas`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zero Kyats Only`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Pyas`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -175,21 +211,24 @@ toWords.convert(input as number, { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Pyas`), ''); | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)('convert %d => %s', (input, expected) => { | ||
expect( | ||
toWords.convert(input as number, { | ||
currency: true, | ||
ignoreZeroCurrency: true, | ||
ignoreDecimal: true, | ||
}), | ||
).toBe(expected); | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Pyas`), ''); | ||
}); | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)( | ||
'convert %d => %s', | ||
(input, expected) => { | ||
expect( | ||
toWords.convert(input as number, { | ||
currency: true, | ||
ignoreZeroCurrency: true, | ||
ignoreDecimal: true, | ||
}), | ||
).toBe(expected); | ||
}, | ||
); | ||
}); |
@@ -1,8 +0,24 @@ | ||
import { ToWords } from '../src/to-words'; | ||
import cloneDeep from 'lodash/cloneDeep'; | ||
import { cloneDeep } from 'lodash'; | ||
import { ToWords } from '../src/ToWords'; | ||
import enMu from '../src/locales/en-MU'; | ||
const localeCode = 'en-MU'; | ||
const toWords = new ToWords({ | ||
localeCode: 'en-MU', | ||
localeCode, | ||
}); | ||
describe('Test Locale', () => { | ||
test(`Locale Class: ${localeCode}`, () => { | ||
expect(toWords.getLocaleClass()).toBe(enMu); | ||
}); | ||
const wrongLocaleCode = localeCode + '-wrong'; | ||
test(`Wrong Locale: ${wrongLocaleCode}`, () => { | ||
const toWordsWrongLocale = new ToWords({ | ||
localeCode: wrongLocaleCode, | ||
}); | ||
expect(() => toWordsWrongLocale.convert(1)).toThrow(/Unknown Locale/); | ||
}); | ||
}); | ||
const testIntegers = [ | ||
@@ -12,4 +28,6 @@ [0, 'Zero'], | ||
[700, 'Seven Hundred'], | ||
[1100, 'One Thousand One Hundred'], | ||
[4680, 'Four Thousand Six Hundred Eighty'], | ||
[63892, 'Sixty Three Thousand Eight Hundred Ninety Two'], | ||
[86100, 'Eighty Six Thousand One Hundred'], | ||
[792581, 'Seven Lakh Ninety Two Thousand Five Hundred Eighty One'], | ||
@@ -33,3 +51,3 @@ [2741034, 'Twenty Seven Lakh Forty One Thousand Thirty Four'], | ||
describe('Test Integers with options = {}', () => { | ||
test.each(testIntegers)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testIntegers)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -39,13 +57,13 @@ }); | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
test.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -55,9 +73,25 @@ }); | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Rupees Only`; | ||
describe('Test Integers with options = { currency: true }', () => { | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Rupees Only`; | ||
}); | ||
test.concurrent.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
}); | ||
}); | ||
describe('Test Integers with options = { currency: true }', () => { | ||
test.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
describe('Test Negative Integers with options = { currency: true }', () => { | ||
const testNegativeIntegersWithCurrency = cloneDeep(testIntegers); | ||
testNegativeIntegersWithCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = `${row[1]} Rupees Only`; | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]} Rupees Only`; | ||
}); | ||
test.concurrent.each(testNegativeIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
@@ -67,7 +101,9 @@ }); | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegersWithCurrency); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
row[1] = i === 0 ? '' : `${row[1]} Rupees Only`; | ||
}); | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -97,3 +133,3 @@ toWords.convert(input as number, { | ||
describe('Test Floats with options = {}', () => { | ||
test.each(testFloats)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloats)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -118,3 +154,3 @@ }); | ||
describe('Test Floats with options = { currency: true }', () => { | ||
test.each(testFloatsWithCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
@@ -124,16 +160,16 @@ }); | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zero Rupees And `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zero Rupees And `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -148,13 +184,13 @@ toWords.convert(input as number, { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zero Rupees Only`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Cents`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zero Rupees Only`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Cents`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -169,21 +205,24 @@ toWords.convert(input as number, { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Cents`), ''); | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)('convert %d => %s', (input, expected) => { | ||
expect( | ||
toWords.convert(input as number, { | ||
currency: true, | ||
ignoreZeroCurrency: true, | ||
ignoreDecimal: true, | ||
}), | ||
).toBe(expected); | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Cents`), ''); | ||
}); | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)( | ||
'convert %d => %s', | ||
(input, expected) => { | ||
expect( | ||
toWords.convert(input as number, { | ||
currency: true, | ||
ignoreZeroCurrency: true, | ||
ignoreDecimal: true, | ||
}), | ||
).toBe(expected); | ||
}, | ||
); | ||
}); |
@@ -1,8 +0,24 @@ | ||
import { ToWords } from '../src/to-words'; | ||
import cloneDeep from 'lodash/cloneDeep'; | ||
import { cloneDeep } from 'lodash'; | ||
import { ToWords } from '../src/ToWords'; | ||
import enNg from '../src/locales/en-NG'; | ||
const localeCode = 'en-NG'; | ||
const toWords = new ToWords({ | ||
localeCode: 'en-NG', | ||
localeCode, | ||
}); | ||
describe('Test Locale', () => { | ||
test(`Locale Class: ${localeCode}`, () => { | ||
expect(toWords.getLocaleClass()).toBe(enNg); | ||
}); | ||
const wrongLocaleCode = localeCode + '-wrong'; | ||
test(`Wrong Locale: ${wrongLocaleCode}`, () => { | ||
const toWordsWrongLocale = new ToWords({ | ||
localeCode: wrongLocaleCode, | ||
}); | ||
expect(() => toWordsWrongLocale.convert(1)).toThrow(/Unknown Locale/); | ||
}); | ||
}); | ||
const testIntegers = [ | ||
@@ -12,4 +28,6 @@ [0, 'Zero'], | ||
[700, 'Seven Hundred'], | ||
[1100, 'One Thousand One Hundred'], | ||
[4680, 'Four Thousand Six Hundred Eighty'], | ||
[63892, 'Sixty Three Thousand Eight Hundred Ninety Two'], | ||
[86100, 'Eighty Six Thousand One Hundred'], | ||
[792581, 'Seven Hundred Ninety Two Thousand Five Hundred Eighty One'], | ||
@@ -39,3 +57,3 @@ [2741034, 'Two Million Seven Hundred Forty One Thousand Thirty Four'], | ||
describe('Test Integers with options = {}', () => { | ||
test.each(testIntegers)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testIntegers)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -45,13 +63,13 @@ }); | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
test.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -61,9 +79,25 @@ }); | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Naira Only`; | ||
describe('Test Integers with options = { currency: true }', () => { | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Naira Only`; | ||
}); | ||
test.concurrent.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
}); | ||
}); | ||
describe('Test Integers with options = { currency: true }', () => { | ||
test.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
describe('Test Negative Integers with options = { currency: true }', () => { | ||
const testNegativeIntegersWithCurrency = cloneDeep(testIntegers); | ||
testNegativeIntegersWithCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = `${row[1]} Naira Only`; | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]} Naira Only`; | ||
}); | ||
test.concurrent.each(testNegativeIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
@@ -73,7 +107,9 @@ }); | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegersWithCurrency); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
row[1] = i === 0 ? '' : `${row[1]} Naira Only`; | ||
}); | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -103,3 +139,3 @@ toWords.convert(input as number, { | ||
describe('Test Floats with options = {}', () => { | ||
test.each(testFloats)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloats)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -124,3 +160,3 @@ }); | ||
describe('Test Floats with options = { currency: true }', () => { | ||
test.each(testFloatsWithCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
@@ -130,16 +166,16 @@ }); | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zero Naira And `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zero Naira And `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -154,13 +190,13 @@ toWords.convert(input as number, { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zero Naira Only`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Kobo`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zero Naira Only`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Kobo`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -175,21 +211,24 @@ toWords.convert(input as number, { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Kobo`), ''); | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)('convert %d => %s', (input, expected) => { | ||
expect( | ||
toWords.convert(input as number, { | ||
currency: true, | ||
ignoreZeroCurrency: true, | ||
ignoreDecimal: true, | ||
}), | ||
).toBe(expected); | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Kobo`), ''); | ||
}); | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)( | ||
'convert %d => %s', | ||
(input, expected) => { | ||
expect( | ||
toWords.convert(input as number, { | ||
currency: true, | ||
ignoreZeroCurrency: true, | ||
ignoreDecimal: true, | ||
}), | ||
).toBe(expected); | ||
}, | ||
); | ||
}); |
@@ -1,8 +0,24 @@ | ||
import { ToWords } from '../src/to-words'; | ||
import cloneDeep from 'lodash/cloneDeep'; | ||
import { cloneDeep } from 'lodash'; | ||
import { ToWords } from '../src/ToWords'; | ||
import enUs from '../src/locales/en-US'; | ||
const localeCode = 'en-US'; | ||
const toWords = new ToWords({ | ||
localeCode: 'en-US', | ||
localeCode, | ||
}); | ||
describe('Test Locale', () => { | ||
test(`Locale Class: ${localeCode}`, () => { | ||
expect(toWords.getLocaleClass()).toBe(enUs); | ||
}); | ||
const wrongLocaleCode = localeCode + '-wrong'; | ||
test(`Wrong Locale: ${wrongLocaleCode}`, () => { | ||
const toWordsWrongLocale = new ToWords({ | ||
localeCode: wrongLocaleCode, | ||
}); | ||
expect(() => toWordsWrongLocale.convert(1)).toThrow(/Unknown Locale/); | ||
}); | ||
}); | ||
const testIntegers = [ | ||
@@ -12,4 +28,6 @@ [0, 'Zero'], | ||
[700, 'Seven Hundred'], | ||
[1100, 'One Thousand One Hundred'], | ||
[4680, 'Four Thousand Six Hundred Eighty'], | ||
[63892, 'Sixty Three Thousand Eight Hundred Ninety Two'], | ||
[86100, 'Eighty Six Thousand One Hundred'], | ||
[792581, 'Seven Hundred Ninety Two Thousand Five Hundred Eighty One'], | ||
@@ -39,3 +57,3 @@ [2741034, 'Two Million Seven Hundred Forty One Thousand Thirty Four'], | ||
describe('Test Integers with options = {}', () => { | ||
test.each(testIntegers)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testIntegers)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -45,13 +63,13 @@ }); | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
test.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -61,9 +79,25 @@ }); | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Dollars Only`; | ||
describe('Test Integers with options = { currency: true }', () => { | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Dollars Only`; | ||
}); | ||
test.concurrent.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
}); | ||
}); | ||
describe('Test Integers with options = { currency: true }', () => { | ||
test.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
describe('Test Negative Integers with options = { currency: true }', () => { | ||
const testNegativeIntegersWithCurrency = cloneDeep(testIntegers); | ||
testNegativeIntegersWithCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = `${row[1]} Dollars Only`; | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Minus ${row[1]} Dollars Only`; | ||
}); | ||
test.concurrent.each(testNegativeIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
@@ -73,7 +107,9 @@ }); | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegersWithCurrency); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
row[1] = i === 0 ? '' : `${row[1]} Dollars Only`; | ||
}); | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -103,3 +139,3 @@ toWords.convert(input as number, { | ||
describe('Test Floats with options = {}', () => { | ||
test.each(testFloats)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloats)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number)).toBe(expected); | ||
@@ -124,3 +160,3 @@ }); | ||
describe('Test Floats with options = { currency: true }', () => { | ||
test.each(testFloatsWithCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrency)('convert %d => %s', (input, expected) => { | ||
expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
@@ -130,16 +166,16 @@ }); | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zero Dollars And `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zero Dollars And `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -154,13 +190,13 @@ toWords.convert(input as number, { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zero Dollars Only`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Cents`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zero Dollars Only`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Cents`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
expect( | ||
@@ -175,21 +211,24 @@ toWords.convert(input as number, { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Cents`), ''); | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)('convert %d => %s', (input, expected) => { | ||
expect( | ||
toWords.convert(input as number, { | ||
currency: true, | ||
ignoreZeroCurrency: true, | ||
ignoreDecimal: true, | ||
}), | ||
).toBe(expected); | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` And [\\w ]+ Cents`), ''); | ||
}); | ||
test.concurrent.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)( | ||
'convert %d => %s', | ||
(input, expected) => { | ||
expect( | ||
toWords.convert(input as number, { | ||
currency: true, | ||
ignoreZeroCurrency: true, | ||
ignoreDecimal: true, | ||
}), | ||
).toBe(expected); | ||
}, | ||
); | ||
}); |
@@ -1,8 +0,24 @@ | ||
import { ToWords } from '../src/to-words'; | ||
import cloneDeep from 'lodash/cloneDeep'; | ||
import { cloneDeep } from 'lodash'; | ||
import { ToWords } from '../src/ToWords'; | ||
import faIr from '../src/locales/fa-IR'; | ||
const localeCode = 'fa-IR'; | ||
const toWords = new ToWords({ | ||
localeCode: 'fa-IR', | ||
localeCode, | ||
}); | ||
describe('Test Locale', () => { | ||
test(`Locale Class: ${localeCode}`, () => { | ||
expect(toWords.getLocaleClass()).toBe(faIr); | ||
}); | ||
const wrongLocaleCode = localeCode + '-wrong'; | ||
test(`Wrong Locale: ${wrongLocaleCode}`, () => { | ||
const toWordsWrongLocale = new ToWords({ | ||
localeCode: wrongLocaleCode, | ||
}); | ||
expect(() => toWordsWrongLocale.convert(1)).toThrow(/Unknown Locale/); | ||
}); | ||
}); | ||
const testIntegers = [ | ||
@@ -37,12 +53,12 @@ [0, 'صفر'], | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `منفی ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `منفی ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
test.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
@@ -53,8 +69,8 @@ expect(toWords.convert(input as number)).toBe(expected); | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} تومان`; | ||
}); | ||
describe('Test Integers with options = { currency: true }', () => { | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} تومان`; | ||
}); | ||
describe('Test Integers with options = { currency: true }', () => { | ||
test.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
@@ -65,6 +81,8 @@ expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegersWithCurrency); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
row[1] = i === 0 ? '' : `${row[1]} تومان`; | ||
}); | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
@@ -120,15 +138,15 @@ expect( | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`صفر تومان`, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`صفر تومان`, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
@@ -144,8 +162,10 @@ expect( | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency).map((row) => { | ||
if (row[0] >= 0 && row[0] < 1) return [row[0], 'صفر تومان']; | ||
return [row[0], 'سی و هفت تومان']; | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency).map((row) => { | ||
if (row[0] >= 0 && row[0] < 1) { | ||
return [row[0], 'صفر تومان']; | ||
} | ||
return [row[0], 'سی و هفت تومان']; | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
@@ -161,8 +181,10 @@ expect( | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency).map((row) => { | ||
if (row[0] >= 0 && row[0] < 1) return [row[0], '']; | ||
return [row[0], 'سی و هفت تومان']; | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true, ignoreDecimal: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency).map((row) => { | ||
if (row[0] >= 0 && row[0] < 1) { | ||
return [row[0], '']; | ||
} | ||
return [row[0], 'سی و هفت تومان']; | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)('convert %d => %s', (input, expected) => { | ||
@@ -169,0 +191,0 @@ expect( |
@@ -1,8 +0,24 @@ | ||
import { ToWords } from '../src/to-words'; | ||
import cloneDeep from 'lodash/cloneDeep'; | ||
import { cloneDeep } from 'lodash'; | ||
import { ToWords } from '../src/ToWords'; | ||
import frFr from '../src/locales/fr-FR'; | ||
const localeCode = 'fr-FR'; | ||
const toWords = new ToWords({ | ||
localeCode: 'fr-FR', | ||
localeCode, | ||
}); | ||
describe('Test Locale', () => { | ||
test(`Locale Class: ${localeCode}`, () => { | ||
expect(toWords.getLocaleClass()).toBe(frFr); | ||
}); | ||
const wrongLocaleCode = localeCode + '-wrong'; | ||
test(`Wrong Locale: ${wrongLocaleCode}`, () => { | ||
const toWordsWrongLocale = new ToWords({ | ||
localeCode: wrongLocaleCode, | ||
}); | ||
expect(() => toWordsWrongLocale.convert(1)).toThrow(/Unknown Locale/); | ||
}); | ||
}); | ||
const testIntegers = [ | ||
@@ -43,12 +59,12 @@ [0, 'Zéro'], | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Moins ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
const testNegativeIntegers = cloneDeep(testIntegers); | ||
testNegativeIntegers.map((row, i) => { | ||
if (i === 0) { | ||
return; | ||
} | ||
row[0] = -row[0]; | ||
row[1] = `Moins ${row[1]}`; | ||
}); | ||
describe('Test Negative Integers with options = {}', () => { | ||
test.each(testNegativeIntegers)('convert %d => %s', (input, expected) => { | ||
@@ -59,8 +75,8 @@ expect(toWords.convert(input as number)).toBe(expected); | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Euros`; | ||
}); | ||
describe('Test Integers with options = { currency: true }', () => { | ||
const testIntegersWithCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrency.map((row) => { | ||
row[1] = `${row[1]} Euros`; | ||
}); | ||
describe('Test Integers with options = { currency: true }', () => { | ||
test.each(testIntegersWithCurrency)('convert %d => %s', (input, expected) => { | ||
@@ -71,6 +87,8 @@ expect(toWords.convert(input as number, { currency: true })).toBe(expected); | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegersWithCurrency); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testIntegersWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testIntegers); | ||
testIntegersWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
row[1] = i === 0 ? '' : `${row[1]} Euros`; | ||
}); | ||
describe('Test Integers with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testIntegersWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
@@ -126,15 +144,15 @@ expect( | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zéro Euros Et `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrency = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrency.map((row, i) => { | ||
if (i === 0) { | ||
row[1] = ''; | ||
return; | ||
} | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = (row[1] as string).replace(`Zéro Euros Et `, ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrency)('convert %d => %s', (input, expected) => { | ||
@@ -150,12 +168,12 @@ expect( | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zéro Euros`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` Et [\\w\\- ]+ Centimes`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreDecimal = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreDecimal.map((row) => { | ||
if (row[0] === 0.999) { | ||
row[1] = `Zéro Euros`; | ||
} else { | ||
row[1] = (row[1] as string).replace(new RegExp(` Et [\\w\\- ]+ Centimes`), ''); | ||
} | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreDecimal)('convert %d => %s', (input, expected) => { | ||
@@ -171,12 +189,12 @@ expect( | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` Et [\\w\\- ]+ Centimes`), ''); | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true, ignoreDecimal: true }', () => { | ||
const testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals = cloneDeep(testFloatsWithCurrency); | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals[0][1] = ''; | ||
testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals.map((row) => { | ||
if (row[0] > 0 && row[0] < 1) { | ||
row[1] = ''; | ||
} | ||
row[1] = (row[1] as string).replace(new RegExp(` Et [\\w\\- ]+ Centimes`), ''); | ||
}); | ||
describe('Test Floats with options = { currency: true, ignoreZeroCurrency: true, ignoreDecimal: true }', () => { | ||
test.each(testFloatsWithCurrencyAndIgnoreZeroCurrencyAndIgnoreDecimals)('convert %d => %s', (input, expected) => { | ||
@@ -183,0 +201,0 @@ expect( |
@@ -8,3 +8,3 @@ module.exports = { | ||
}, | ||
plugins: ['@typescript-eslint', 'jest'], | ||
plugins: ['@typescript-eslint', 'jest', 'import'], | ||
extends: [ | ||
@@ -11,0 +11,0 @@ 'eslint:recommended', |
@@ -5,2 +5,15 @@ # Changelog | ||
## [3.0.0-alpha.0](https://github.com/mastermunj/to-words/compare/v2.5.0...v3.0.0-alpha.0) (2021-09-04) | ||
### Features | ||
* refactor and new languages ([ec68e6c](https://github.com/mastermunj/to-words/commit/ec68e6c35a1d9d2ad68a6dd741cb71682681ed79)) | ||
### Bug Fixes | ||
* remove default class export to keep import syntax same ([bc15df6](https://github.com/mastermunj/to-words/commit/bc15df67836750a010531281f39ff21d5e79773c)) | ||
* resolve rebase issue ([2d175f2](https://github.com/mastermunj/to-words/commit/2d175f2d6f8a9f088ed1679817ee29298164bed1)) | ||
## [2.5.0](https://github.com/mastermunj/to-words/compare/v2.4.0...v2.5.0) (2021-08-24) | ||
@@ -7,0 +20,0 @@ |
@@ -1,23 +0,4 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
export declare class Locale implements LocaleInterface { | ||
currency: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
fractionalUnit: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
}; | ||
}; | ||
texts: { | ||
and: string; | ||
minus: string; | ||
only: string; | ||
point: string; | ||
}; | ||
numberWordsMapping: { | ||
number: number; | ||
value: string; | ||
}[]; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Locale = void 0; | ||
class Locale { | ||
constructor() { | ||
this.currency = { | ||
name: 'Cedis', | ||
plural: 'Cedis', | ||
symbol: 'GH¢', | ||
fractionalUnit: { | ||
name: 'Pasewas', | ||
plural: 'Pasewas', | ||
symbol: 'Gp', | ||
this.config = { | ||
currency: { | ||
name: 'Cedi', | ||
plural: 'Cedis', | ||
symbol: 'GH¢', | ||
fractionalUnit: { | ||
name: 'Pesewa', | ||
plural: 'Pesewas', | ||
symbol: 'Gp', | ||
}, | ||
}, | ||
texts: { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
], | ||
exactWordsMapping: [{ number: 100, value: 'One Hundred' }], | ||
}; | ||
this.texts = { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}; | ||
this.numberWordsMapping = [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
]; | ||
} | ||
} | ||
exports.Locale = Locale; | ||
exports.default = Locale; |
@@ -1,23 +0,4 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
export declare class Locale implements LocaleInterface { | ||
currency: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
fractionalUnit: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
}; | ||
}; | ||
texts: { | ||
and: string; | ||
minus: string; | ||
only: string; | ||
point: string; | ||
}; | ||
numberWordsMapping: { | ||
number: number; | ||
value: string; | ||
}[]; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Locale = void 0; | ||
class Locale { | ||
constructor() { | ||
this.currency = { | ||
name: 'Rupee', | ||
plural: 'Rupees', | ||
symbol: '₹', | ||
fractionalUnit: { | ||
name: 'Paisa', | ||
plural: 'Paise', | ||
symbol: '', | ||
this.config = { | ||
currency: { | ||
name: 'Rupee', | ||
plural: 'Rupees', | ||
symbol: '₹', | ||
fractionalUnit: { | ||
name: 'Paisa', | ||
plural: 'Paise', | ||
symbol: '', | ||
}, | ||
}, | ||
texts: { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 10000000, value: 'Crore' }, | ||
{ number: 100000, value: 'Lakh' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
], | ||
exactWordsMapping: [{ number: 100, value: 'One Hundred' }], | ||
}; | ||
this.texts = { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}; | ||
this.numberWordsMapping = [ | ||
{ number: 10000000, value: 'Crore' }, | ||
{ number: 100000, value: 'Lakh' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
]; | ||
} | ||
} | ||
exports.Locale = Locale; | ||
exports.default = Locale; |
@@ -1,23 +0,4 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
export declare class Locale implements LocaleInterface { | ||
currency: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
fractionalUnit: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
}; | ||
}; | ||
texts: { | ||
and: string; | ||
minus: string; | ||
only: string; | ||
point: string; | ||
}; | ||
numberWordsMapping: { | ||
number: number; | ||
value: string; | ||
}[]; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Locale = void 0; | ||
class Locale { | ||
constructor() { | ||
this.currency = { | ||
name: 'Kyat', | ||
plural: 'Kyats', | ||
symbol: 'K', | ||
fractionalUnit: { | ||
name: 'Pya', | ||
plural: 'Pyas', | ||
symbol: '', | ||
this.config = { | ||
currency: { | ||
name: 'Kyat', | ||
plural: 'Kyats', | ||
symbol: 'K', | ||
fractionalUnit: { | ||
name: 'Pya', | ||
plural: 'Pyas', | ||
symbol: '', | ||
}, | ||
}, | ||
texts: { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
], | ||
exactWordsMapping: [{ number: 100, value: 'One Hundred' }], | ||
}; | ||
this.texts = { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}; | ||
this.numberWordsMapping = [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
]; | ||
} | ||
} | ||
exports.Locale = Locale; | ||
exports.default = Locale; |
@@ -1,23 +0,4 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
export declare class Locale implements LocaleInterface { | ||
currency: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
fractionalUnit: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
}; | ||
}; | ||
texts: { | ||
and: string; | ||
minus: string; | ||
only: string; | ||
point: string; | ||
}; | ||
numberWordsMapping: { | ||
number: number; | ||
value: string; | ||
}[]; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Locale = void 0; | ||
class Locale { | ||
constructor() { | ||
this.currency = { | ||
name: 'Rupee', | ||
plural: 'Rupees', | ||
symbol: 'Rs', | ||
fractionalUnit: { | ||
name: 'Cent', | ||
plural: 'Cents', | ||
symbol: '', | ||
this.config = { | ||
currency: { | ||
name: 'Rupee', | ||
plural: 'Rupees', | ||
symbol: 'Rs', | ||
fractionalUnit: { | ||
name: 'Cent', | ||
plural: 'Cents', | ||
symbol: '', | ||
}, | ||
}, | ||
texts: { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 10000000, value: 'Crore' }, | ||
{ number: 100000, value: 'Lakh' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
], | ||
exactWordsMapping: [{ number: 100, value: 'One Hundred' }], | ||
}; | ||
this.texts = { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}; | ||
this.numberWordsMapping = [ | ||
{ number: 10000000, value: 'Crore' }, | ||
{ number: 100000, value: 'Lakh' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
]; | ||
} | ||
} | ||
exports.Locale = Locale; | ||
exports.default = Locale; |
@@ -1,23 +0,4 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
export declare class Locale implements LocaleInterface { | ||
currency: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
fractionalUnit: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
}; | ||
}; | ||
texts: { | ||
and: string; | ||
minus: string; | ||
only: string; | ||
point: string; | ||
}; | ||
numberWordsMapping: { | ||
number: number; | ||
value: string; | ||
}[]; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Locale = void 0; | ||
class Locale { | ||
constructor() { | ||
this.currency = { | ||
name: 'Naira', | ||
plural: 'Naira', | ||
symbol: '₦', | ||
fractionalUnit: { | ||
name: 'Kobo', | ||
plural: 'Kobo', | ||
symbol: '', | ||
this.config = { | ||
currency: { | ||
name: 'Naira', | ||
plural: 'Naira', | ||
symbol: '₦', | ||
fractionalUnit: { | ||
name: 'Kobo', | ||
plural: 'Kobo', | ||
symbol: '', | ||
}, | ||
}, | ||
texts: { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
], | ||
exactWordsMapping: [{ number: 100, value: 'One Hundred' }], | ||
}; | ||
this.texts = { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}; | ||
this.numberWordsMapping = [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
]; | ||
} | ||
} | ||
exports.Locale = Locale; | ||
exports.default = Locale; |
@@ -1,23 +0,4 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
export declare class Locale implements LocaleInterface { | ||
currency: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
fractionalUnit: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
}; | ||
}; | ||
texts: { | ||
and: string; | ||
minus: string; | ||
only: string; | ||
point: string; | ||
}; | ||
numberWordsMapping: { | ||
number: number; | ||
value: string; | ||
}[]; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Locale = void 0; | ||
class Locale { | ||
constructor() { | ||
this.currency = { | ||
name: 'Dollar', | ||
plural: 'Dollars', | ||
symbol: '$', | ||
fractionalUnit: { | ||
name: 'Cent', | ||
plural: 'Cents', | ||
symbol: '¢', | ||
this.config = { | ||
currency: { | ||
name: 'Dollar', | ||
plural: 'Dollars', | ||
symbol: '$', | ||
fractionalUnit: { | ||
name: 'Cent', | ||
plural: 'Cents', | ||
symbol: '¢', | ||
}, | ||
}, | ||
texts: { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
], | ||
exactWordsMapping: [{ number: 100, value: 'One Hundred' }], | ||
}; | ||
this.texts = { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}; | ||
this.numberWordsMapping = [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
]; | ||
} | ||
} | ||
exports.Locale = Locale; | ||
exports.default = Locale; |
@@ -1,39 +0,4 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
export declare class Locale implements LocaleInterface { | ||
currency: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
fractionalUnit: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
}; | ||
}; | ||
texts: { | ||
and: string; | ||
minus: string; | ||
only: string; | ||
point: string; | ||
}; | ||
options: { | ||
namedLessThan1000: boolean; | ||
splitWord: string; | ||
ignoreZeroInDecimals: boolean; | ||
}; | ||
decimalLengthWordMapping: { | ||
1: string; | ||
2: string; | ||
3: string; | ||
4: string; | ||
5: string; | ||
6: string; | ||
7: string; | ||
8: string; | ||
9: string; | ||
}; | ||
numberWordsMapping: { | ||
number: number; | ||
value: string; | ||
}[]; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Locale = void 0; | ||
class Locale { | ||
constructor() { | ||
this.currency = { | ||
name: 'تومان', | ||
plural: '', | ||
symbol: 'تومان', | ||
fractionalUnit: { | ||
name: '', | ||
plural: 'تومان', | ||
symbol: '', | ||
this.config = { | ||
currency: { | ||
name: 'تومان', | ||
plural: '', | ||
symbol: 'تومان', | ||
fractionalUnit: { | ||
name: '', | ||
plural: 'تومان', | ||
symbol: '', | ||
}, | ||
}, | ||
}; | ||
this.texts = { | ||
and: 'و', | ||
minus: 'منفی', | ||
only: '', | ||
point: 'و', | ||
}; | ||
this.options = { | ||
texts: { | ||
and: 'و', | ||
minus: 'منفی', | ||
only: '', | ||
point: 'و', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 1000000000000000, value: 'کوادریلیون' }, | ||
{ number: 1000000000000, value: 'تیلیارد' }, | ||
{ number: 1000000000, value: 'میلیارد' }, | ||
{ number: 1000000, value: 'میلیون' }, | ||
{ number: 1000, value: 'هزار' }, | ||
{ number: 900, value: 'نهصد' }, | ||
{ number: 800, value: 'هشتصد' }, | ||
{ number: 700, value: 'هفتصد' }, | ||
{ number: 600, value: 'ششصد' }, | ||
{ number: 500, value: 'پانصد' }, | ||
{ number: 400, value: 'چهارصد' }, | ||
{ number: 300, value: 'سیصد' }, | ||
{ number: 200, value: 'دویست' }, | ||
{ number: 100, value: 'صد' }, | ||
{ number: 90, value: 'نود' }, | ||
{ number: 80, value: 'هشتاد' }, | ||
{ number: 70, value: 'هفتاد' }, | ||
{ number: 60, value: 'شصت' }, | ||
{ number: 50, value: 'پنجاه' }, | ||
{ number: 40, value: 'چهل' }, | ||
{ number: 30, value: 'سی' }, | ||
{ number: 20, value: 'بیست' }, | ||
{ number: 19, value: 'نوزده' }, | ||
{ number: 18, value: 'هجده' }, | ||
{ number: 17, value: 'هفده' }, | ||
{ number: 16, value: 'شانزده' }, | ||
{ number: 15, value: 'پانزده' }, | ||
{ number: 14, value: 'چهارده' }, | ||
{ number: 13, value: 'سیزده' }, | ||
{ number: 12, value: 'دوازده' }, | ||
{ number: 11, value: 'یازده' }, | ||
{ number: 10, value: 'ده' }, | ||
{ number: 9, value: 'نه' }, | ||
{ number: 8, value: 'هشت' }, | ||
{ number: 7, value: 'هفت' }, | ||
{ number: 6, value: 'شش' }, | ||
{ number: 5, value: 'پنج' }, | ||
{ number: 4, value: 'چهار' }, | ||
{ number: 3, value: 'سه' }, | ||
{ number: 2, value: 'دو' }, | ||
{ number: 1, value: 'یک' }, | ||
{ number: 0, value: 'صفر' }, | ||
], | ||
namedLessThan1000: true, | ||
splitWord: 'و', | ||
ignoreZeroInDecimals: true, | ||
decimalLengthWordMapping: { | ||
1: 'دهم', | ||
2: 'صدم', | ||
3: 'هزارم', | ||
4: 'دههزارم', | ||
5: 'صدهزارم', | ||
6: 'میلیونیوم', | ||
7: 'دهمیلیونیوم', | ||
8: 'صدمیلیونیوم', | ||
9: 'میلیاردیوم', | ||
}, | ||
}; | ||
this.decimalLengthWordMapping = { | ||
1: 'دهم', | ||
2: 'صدم', | ||
3: 'هزارم', | ||
4: 'دههزارم', | ||
5: 'صدهزارم', | ||
6: 'میلیونیوم', | ||
7: 'دهمیلیونیوم', | ||
8: 'صدمیلیونیوم', | ||
9: 'میلیاردیوم', | ||
}; | ||
this.numberWordsMapping = [ | ||
{ number: 1000000000000000, value: 'کوادریلیون' }, | ||
{ number: 1000000000000, value: 'تیلیارد' }, | ||
{ number: 1000000000, value: 'میلیارد' }, | ||
{ number: 1000000, value: 'میلیون' }, | ||
{ number: 1000, value: 'هزار' }, | ||
{ number: 900, value: 'نهصد' }, | ||
{ number: 800, value: 'هشتصد' }, | ||
{ number: 700, value: 'هفتصد' }, | ||
{ number: 600, value: 'ششصد' }, | ||
{ number: 500, value: 'پانصد' }, | ||
{ number: 400, value: 'چهارصد' }, | ||
{ number: 300, value: 'سیصد' }, | ||
{ number: 200, value: 'دویست' }, | ||
{ number: 100, value: 'صد' }, | ||
{ number: 90, value: 'نود' }, | ||
{ number: 80, value: 'هشتاد' }, | ||
{ number: 70, value: 'هفتاد' }, | ||
{ number: 60, value: 'شصت' }, | ||
{ number: 50, value: 'پنجاه' }, | ||
{ number: 40, value: 'چهل' }, | ||
{ number: 30, value: 'سی' }, | ||
{ number: 20, value: 'بیست' }, | ||
{ number: 19, value: 'نوزده' }, | ||
{ number: 18, value: 'هجده' }, | ||
{ number: 17, value: 'هفده' }, | ||
{ number: 16, value: 'شانزده' }, | ||
{ number: 15, value: 'پانزده' }, | ||
{ number: 14, value: 'چهارده' }, | ||
{ number: 13, value: 'سیزده' }, | ||
{ number: 12, value: 'دوازده' }, | ||
{ number: 11, value: 'یازده' }, | ||
{ number: 10, value: 'ده' }, | ||
{ number: 9, value: 'نه' }, | ||
{ number: 8, value: 'هشت' }, | ||
{ number: 7, value: 'هفت' }, | ||
{ number: 6, value: 'شش' }, | ||
{ number: 5, value: 'پنج' }, | ||
{ number: 4, value: 'چهار' }, | ||
{ number: 3, value: 'سه' }, | ||
{ number: 2, value: 'دو' }, | ||
{ number: 1, value: 'یک' }, | ||
{ number: 0, value: 'صفر' }, | ||
]; | ||
} | ||
} | ||
exports.Locale = Locale; | ||
exports.default = Locale; |
@@ -1,28 +0,4 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
export declare class Locale implements LocaleInterface { | ||
currency: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
fractionalUnit: { | ||
name: string; | ||
plural: string; | ||
symbol: string; | ||
}; | ||
}; | ||
options: { | ||
ignoreOneForWords: string[]; | ||
pluralMark: string; | ||
pluralWords: string[]; | ||
}; | ||
texts: { | ||
and: string; | ||
minus: string; | ||
only: string; | ||
point: string; | ||
}; | ||
numberWordsMapping: { | ||
number: number; | ||
value: string; | ||
}[]; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export default class Locale implements LocaleInterface { | ||
config: LocaleConfig; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Locale = void 0; | ||
class Locale { | ||
constructor() { | ||
this.currency = { | ||
name: 'Euro', | ||
plural: 'Euros', | ||
symbol: '€', | ||
fractionalUnit: { | ||
name: 'Centime', | ||
plural: 'Centimes', | ||
symbol: 'Cts', | ||
this.config = { | ||
currency: { | ||
name: 'Euro', | ||
plural: 'Euros', | ||
symbol: '€', | ||
fractionalUnit: { | ||
name: 'Centime', | ||
plural: 'Centimes', | ||
symbol: 'Cts', | ||
}, | ||
}, | ||
}; | ||
this.options = { | ||
texts: { | ||
and: 'Et', | ||
minus: 'Moins', | ||
only: '', | ||
point: 'Virgule', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 1000000000000000, value: 'Billiard' }, | ||
{ number: 1000000000000, value: 'Billion' }, | ||
{ number: 1000000000, value: 'Milliard' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Mille' }, | ||
{ number: 100, value: 'Cent' }, | ||
{ number: 99, value: 'Quatre-Vingt-Dix-Neuf' }, | ||
{ number: 98, value: 'Quatre-Vingt-Dix-Huit' }, | ||
{ number: 97, value: 'Quatre-Vingt-Dix-Sept' }, | ||
{ number: 96, value: 'Quatre-Vingt-Seize' }, | ||
{ number: 95, value: 'Quatre-Vingt-Quinze' }, | ||
{ number: 94, value: 'Quatre-Vingt-Quatorze' }, | ||
{ number: 93, value: 'Quatre-Vingt-Treize' }, | ||
{ number: 92, value: 'Quatre-Vingt-Douze' }, | ||
{ number: 91, value: 'Quatre-Vingt-Onze' }, | ||
{ number: 90, value: 'Quatre-Vingt-Dix' }, | ||
{ number: 89, value: 'Quatre-Vingt-Neuf' }, | ||
{ number: 88, value: 'Quatre-Vingt-Huit' }, | ||
{ number: 87, value: 'Quatre-Vingt-Sept' }, | ||
{ number: 86, value: 'Quatre-Vingt-Six' }, | ||
{ number: 85, value: 'Quatre-Vingt-Cinq' }, | ||
{ number: 84, value: 'Quatre-Vingt-Quatre' }, | ||
{ number: 83, value: 'Quatre-Vingt-Trois' }, | ||
{ number: 82, value: 'Quatre-Vingt-Deux' }, | ||
{ number: 81, value: 'Quatre-Vingt-Un' }, | ||
{ number: 80, value: 'Quatre-Vingt' }, | ||
{ number: 79, value: 'Soixante-Dix-Neuf' }, | ||
{ number: 78, value: 'Soixante-Dix-Huit' }, | ||
{ number: 77, value: 'Soixante-Dix-Sept' }, | ||
{ number: 76, value: 'Soixante-Seize' }, | ||
{ number: 75, value: 'Soixante-Quinze' }, | ||
{ number: 74, value: 'Soixante-Quatorze' }, | ||
{ number: 73, value: 'Soixante-Treize' }, | ||
{ number: 72, value: 'Soixante-Douze' }, | ||
{ number: 71, value: 'Soixante Et Onze' }, | ||
{ number: 70, value: 'Soixante-dix' }, | ||
{ number: 69, value: 'Soixante-Neuf' }, | ||
{ number: 68, value: 'Soixante-Huit' }, | ||
{ number: 67, value: 'Soixante-Sept' }, | ||
{ number: 66, value: 'Soixante-Six' }, | ||
{ number: 65, value: 'Soixante-Cinq' }, | ||
{ number: 64, value: 'Soixante-Quatre' }, | ||
{ number: 63, value: 'Soixante-Trois' }, | ||
{ number: 62, value: 'Soixante-Deux' }, | ||
{ number: 61, value: 'Soixante Et Un' }, | ||
{ number: 60, value: 'Soixante' }, | ||
{ number: 59, value: 'Cinquante-Neuf' }, | ||
{ number: 58, value: 'Cinquante-Huit' }, | ||
{ number: 57, value: 'Cinquante-Sept' }, | ||
{ number: 56, value: 'Cinquante-Six' }, | ||
{ number: 55, value: 'Cinquante-Cinq' }, | ||
{ number: 54, value: 'Cinquante-Quatre' }, | ||
{ number: 53, value: 'Cinquante-Trois' }, | ||
{ number: 52, value: 'Cinquante-Deux' }, | ||
{ number: 51, value: 'Cinquante Et Un' }, | ||
{ number: 50, value: 'Cinquante' }, | ||
{ number: 49, value: 'Quarante-Neuf' }, | ||
{ number: 48, value: 'Quarante-Huit' }, | ||
{ number: 47, value: 'Quarante-Sept' }, | ||
{ number: 46, value: 'Quarante-Six' }, | ||
{ number: 45, value: 'Quarante-Cinq' }, | ||
{ number: 44, value: 'Quarante-Quatre' }, | ||
{ number: 43, value: 'Quarante-Trois' }, | ||
{ number: 42, value: 'Quarante-Deux' }, | ||
{ number: 41, value: 'Quarante Et Un' }, | ||
{ number: 40, value: 'Quarante' }, | ||
{ number: 39, value: 'Trente-Neuf' }, | ||
{ number: 38, value: 'Trente-Huit' }, | ||
{ number: 37, value: 'Trente-Sept' }, | ||
{ number: 36, value: 'Trente-Six' }, | ||
{ number: 35, value: 'Trente-Cinq' }, | ||
{ number: 34, value: 'Trente-Quatre' }, | ||
{ number: 33, value: 'Trente-Trois' }, | ||
{ number: 32, value: 'Trente-Deux' }, | ||
{ number: 31, value: 'Trente Et Un' }, | ||
{ number: 30, value: 'Trente' }, | ||
{ number: 29, value: 'Vingt-Neuf' }, | ||
{ number: 28, value: 'Vingt-Huit' }, | ||
{ number: 27, value: 'Vingt-Sept' }, | ||
{ number: 26, value: 'Vingt-Six' }, | ||
{ number: 25, value: 'Vingt-Cinq' }, | ||
{ number: 24, value: 'Vingt-Quatre' }, | ||
{ number: 23, value: 'Vingt-Trois' }, | ||
{ number: 22, value: 'Vingt-Deux' }, | ||
{ number: 21, value: 'Vingt Et Un' }, | ||
{ number: 20, value: 'Vingt' }, | ||
{ number: 19, value: 'Dix-Neuf' }, | ||
{ number: 18, value: 'Dix-Huit' }, | ||
{ number: 17, value: 'Dix-Sept' }, | ||
{ number: 16, value: 'Seize' }, | ||
{ number: 15, value: 'Quinze' }, | ||
{ number: 14, value: 'Quatorze' }, | ||
{ number: 13, value: 'Treize' }, | ||
{ number: 12, value: 'Douze' }, | ||
{ number: 11, value: 'Onze' }, | ||
{ number: 10, value: 'Dix' }, | ||
{ number: 9, value: 'Neuf' }, | ||
{ number: 8, value: 'Huit' }, | ||
{ number: 7, value: 'Sept' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Cinq' }, | ||
{ number: 4, value: 'Quatre' }, | ||
{ number: 3, value: 'Trois' }, | ||
{ number: 2, value: 'Deux' }, | ||
{ number: 1, value: 'Un' }, | ||
{ number: 0, value: 'Zéro' }, | ||
], | ||
ignoreOneForWords: ['Cent', 'Mille'], | ||
@@ -21,118 +134,4 @@ pluralMark: 's', | ||
}; | ||
this.texts = { | ||
and: 'Et', | ||
minus: 'Moins', | ||
only: '', | ||
point: 'Virgule', | ||
}; | ||
this.numberWordsMapping = [ | ||
{ number: 1000000000000000, value: 'Billiard' }, | ||
{ number: 1000000000000, value: 'Billion' }, | ||
{ number: 1000000000, value: 'Milliard' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Mille' }, | ||
{ number: 100, value: 'Cent' }, | ||
{ number: 99, value: 'Quatre-Vingt-Dix-Neuf' }, | ||
{ number: 98, value: 'Quatre-Vingt-Dix-Huit' }, | ||
{ number: 97, value: 'Quatre-Vingt-Dix-Sept' }, | ||
{ number: 96, value: 'Quatre-Vingt-Seize' }, | ||
{ number: 95, value: 'Quatre-Vingt-Quinze' }, | ||
{ number: 94, value: 'Quatre-Vingt-Quatorze' }, | ||
{ number: 93, value: 'Quatre-Vingt-Treize' }, | ||
{ number: 92, value: 'Quatre-Vingt-Douze' }, | ||
{ number: 91, value: 'Quatre-Vingt-Onze' }, | ||
{ number: 90, value: 'Quatre-Vingt-Dix' }, | ||
{ number: 89, value: 'Quatre-Vingt-Neuf' }, | ||
{ number: 88, value: 'Quatre-Vingt-Huit' }, | ||
{ number: 87, value: 'Quatre-Vingt-Sept' }, | ||
{ number: 86, value: 'Quatre-Vingt-Six' }, | ||
{ number: 85, value: 'Quatre-Vingt-Cinq' }, | ||
{ number: 84, value: 'Quatre-Vingt-Quatre' }, | ||
{ number: 83, value: 'Quatre-Vingt-Trois' }, | ||
{ number: 82, value: 'Quatre-Vingt-Deux' }, | ||
{ number: 81, value: 'Quatre-Vingt-Un' }, | ||
{ number: 80, value: 'Quatre-Vingt' }, | ||
{ number: 79, value: 'Soixante-Dix-Neuf' }, | ||
{ number: 78, value: 'Soixante-Dix-Huit' }, | ||
{ number: 77, value: 'Soixante-Dix-Sept' }, | ||
{ number: 76, value: 'Soixante-Seize' }, | ||
{ number: 75, value: 'Soixante-Quinze' }, | ||
{ number: 74, value: 'Soixante-Quatorze' }, | ||
{ number: 73, value: 'Soixante-Treize' }, | ||
{ number: 72, value: 'Soixante-Douze' }, | ||
{ number: 71, value: 'Soixante Et Onze' }, | ||
{ number: 70, value: 'Soixante-dix' }, | ||
{ number: 69, value: 'Soixante-Neuf' }, | ||
{ number: 68, value: 'Soixante-Huit' }, | ||
{ number: 67, value: 'Soixante-Sept' }, | ||
{ number: 66, value: 'Soixante-Six' }, | ||
{ number: 65, value: 'Soixante-Cinq' }, | ||
{ number: 64, value: 'Soixante-Quatre' }, | ||
{ number: 63, value: 'Soixante-Trois' }, | ||
{ number: 62, value: 'Soixante-Deux' }, | ||
{ number: 61, value: 'Soixante Et Un' }, | ||
{ number: 60, value: 'Soixante' }, | ||
{ number: 59, value: 'Cinquante-Neuf' }, | ||
{ number: 58, value: 'Cinquante-Huit' }, | ||
{ number: 57, value: 'Cinquante-Sept' }, | ||
{ number: 56, value: 'Cinquante-Six' }, | ||
{ number: 55, value: 'Cinquante-Cinq' }, | ||
{ number: 54, value: 'Cinquante-Quatre' }, | ||
{ number: 53, value: 'Cinquante-Trois' }, | ||
{ number: 52, value: 'Cinquante-Deux' }, | ||
{ number: 51, value: 'Cinquante Et Un' }, | ||
{ number: 50, value: 'Cinquante' }, | ||
{ number: 49, value: 'Quarante-Neuf' }, | ||
{ number: 48, value: 'Quarante-Huit' }, | ||
{ number: 47, value: 'Quarante-Sept' }, | ||
{ number: 46, value: 'Quarante-Six' }, | ||
{ number: 45, value: 'Quarante-Cinq' }, | ||
{ number: 44, value: 'Quarante-Quatre' }, | ||
{ number: 43, value: 'Quarante-Trois' }, | ||
{ number: 42, value: 'Quarante-Deux' }, | ||
{ number: 41, value: 'Quarante Et Un' }, | ||
{ number: 40, value: 'Quarante' }, | ||
{ number: 39, value: 'Trente-Neuf' }, | ||
{ number: 38, value: 'Trente-Huit' }, | ||
{ number: 37, value: 'Trente-Sept' }, | ||
{ number: 36, value: 'Trente-Six' }, | ||
{ number: 35, value: 'Trente-Cinq' }, | ||
{ number: 34, value: 'Trente-Quatre' }, | ||
{ number: 33, value: 'Trente-Trois' }, | ||
{ number: 32, value: 'Trente-Deux' }, | ||
{ number: 31, value: 'Trente Et Un' }, | ||
{ number: 30, value: 'Trente' }, | ||
{ number: 29, value: 'Vingt-Neuf' }, | ||
{ number: 28, value: 'Vingt-Huit' }, | ||
{ number: 27, value: 'Vingt-Sept' }, | ||
{ number: 26, value: 'Vingt-Six' }, | ||
{ number: 25, value: 'Vingt-Cinq' }, | ||
{ number: 24, value: 'Vingt-Quatre' }, | ||
{ number: 23, value: 'Vingt-Trois' }, | ||
{ number: 22, value: 'Vingt-Deux' }, | ||
{ number: 21, value: 'Vingt Et Un' }, | ||
{ number: 20, value: 'Vingt' }, | ||
{ number: 19, value: 'Dix-Neuf' }, | ||
{ number: 18, value: 'Dix-Huit' }, | ||
{ number: 17, value: 'Dix-Sept' }, | ||
{ number: 16, value: 'Seize' }, | ||
{ number: 15, value: 'Quinze' }, | ||
{ number: 14, value: 'Quatorze' }, | ||
{ number: 13, value: 'Treize' }, | ||
{ number: 12, value: 'Douze' }, | ||
{ number: 11, value: 'Onze' }, | ||
{ number: 10, value: 'Dix' }, | ||
{ number: 9, value: 'Neuf' }, | ||
{ number: 8, value: 'Huit' }, | ||
{ number: 7, value: 'Sept' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Cinq' }, | ||
{ number: 4, value: 'Quatre' }, | ||
{ number: 3, value: 'Trois' }, | ||
{ number: 2, value: 'Deux' }, | ||
{ number: 1, value: 'Un' }, | ||
{ number: 0, value: 'Zéro' }, | ||
]; | ||
} | ||
} | ||
exports.Locale = Locale; | ||
exports.default = Locale; |
@@ -1,1 +0,1 @@ | ||
export * from './src/to-words'; | ||
export * from './src/ToWords'; |
{ | ||
"name": "to-words", | ||
"version": "2.5.0", | ||
"version": "3.0.0-alpha.0", | ||
"description": "Converts numbers (including decimal points) into words & currency.", | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
"author": "Munjal Dhamecha", | ||
"main": "dist/to-words.js", | ||
"main": "dist/ToWords.js", | ||
"scripts": { | ||
@@ -30,3 +30,3 @@ "build": "npm run clean && tsc --noEmitOnError", | ||
"clean": "rimraf dist coverage", | ||
"lint": "eslint --ext .js,.ts .", | ||
"lint": "eslint --max-warnings=0 --ext .ts .", | ||
"lint:fix": "npm run lint -- --fix", | ||
@@ -57,4 +57,5 @@ "release": "standard-version", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.24.2", | ||
"eslint-plugin-jest": "^24.4.0", | ||
"eslint-plugin-prettier": "^3.4.1", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"husky": "^7.0.1", | ||
@@ -73,4 +74,4 @@ "jest": "^27.0.6", | ||
"engines": { | ||
"node": ">=10.0.0" | ||
"node": ">=12.0.0" | ||
} | ||
} |
@@ -32,2 +32,3 @@ # Number to Words | ||
ignoreZeroCurrency: false, | ||
doNotAddOnly: false, | ||
} | ||
@@ -92,2 +93,3 @@ }); | ||
| ignoreZeroCurrency | boolean | false | Whether to ignore zero currency value while converting into words. | | ||
| doNotAddOnly | boolean | false | Do not add `only` at the end of the words. This works only when currency = true | | ||
@@ -97,2 +99,3 @@ ## Supported Locale | ||
| ------------- | ------------- | ------------- | | ||
| Ghana | English | en-GH | | ||
| India | English | en-IN (default) | | ||
@@ -106,4 +109,7 @@ | Myanmar | English | en-MM | | ||
| France | French | fr-FR | | ||
| India | Gujarati | gu-IN | | ||
| India | Hindi | hi-IN | | ||
| India | Marathi | mr-IN | | ||
## Inspiration for core logic | ||
[https://stackoverflow.com/a/46221860](https://stackoverflow.com/a/46221860) |
@@ -1,58 +0,59 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export class Locale implements LocaleInterface { | ||
public currency = { | ||
name: 'Cedis', | ||
plural: 'Cedis', | ||
symbol: 'GH¢', | ||
fractionalUnit: { | ||
name: 'Pasewas', | ||
plural: 'Pasewas', | ||
symbol: 'Gp', | ||
export default class Locale implements LocaleInterface { | ||
public config: LocaleConfig = { | ||
currency: { | ||
name: 'Cedi', | ||
plural: 'Cedis', | ||
symbol: 'GH¢', | ||
fractionalUnit: { | ||
name: 'Pesewa', | ||
plural: 'Pesewas', | ||
symbol: 'Gp', | ||
}, | ||
}, | ||
texts: { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
], | ||
exactWordsMapping: [{ number: 100, value: 'One Hundred' }], | ||
}; | ||
public texts = { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}; | ||
public numberWordsMapping = [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
]; | ||
} |
@@ -1,56 +0,57 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export class Locale implements LocaleInterface { | ||
public currency = { | ||
name: 'Rupee', | ||
plural: 'Rupees', | ||
symbol: '₹', | ||
fractionalUnit: { | ||
name: 'Paisa', | ||
plural: 'Paise', | ||
symbol: '', | ||
export default class Locale implements LocaleInterface { | ||
public config: LocaleConfig = { | ||
currency: { | ||
name: 'Rupee', | ||
plural: 'Rupees', | ||
symbol: '₹', | ||
fractionalUnit: { | ||
name: 'Paisa', | ||
plural: 'Paise', | ||
symbol: '', | ||
}, | ||
}, | ||
texts: { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 10000000, value: 'Crore' }, | ||
{ number: 100000, value: 'Lakh' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
], | ||
exactWordsMapping: [{ number: 100, value: 'One Hundred' }], | ||
}; | ||
public texts = { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}; | ||
public numberWordsMapping = [ | ||
{ number: 10000000, value: 'Crore' }, | ||
{ number: 100000, value: 'Lakh' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
]; | ||
} |
@@ -1,58 +0,59 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export class Locale implements LocaleInterface { | ||
public currency = { | ||
name: 'Kyat', | ||
plural: 'Kyats', | ||
symbol: 'K', | ||
fractionalUnit: { | ||
name: 'Pya', | ||
plural: 'Pyas', | ||
symbol: '', | ||
export default class Locale implements LocaleInterface { | ||
public config: LocaleConfig = { | ||
currency: { | ||
name: 'Kyat', | ||
plural: 'Kyats', | ||
symbol: 'K', | ||
fractionalUnit: { | ||
name: 'Pya', | ||
plural: 'Pyas', | ||
symbol: '', | ||
}, | ||
}, | ||
texts: { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
], | ||
exactWordsMapping: [{ number: 100, value: 'One Hundred' }], | ||
}; | ||
public texts = { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}; | ||
public numberWordsMapping = [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
]; | ||
} |
@@ -1,56 +0,57 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export class Locale implements LocaleInterface { | ||
public currency = { | ||
name: 'Rupee', | ||
plural: 'Rupees', | ||
symbol: 'Rs', | ||
fractionalUnit: { | ||
name: 'Cent', | ||
plural: 'Cents', | ||
symbol: '', | ||
export default class Locale implements LocaleInterface { | ||
public config: LocaleConfig = { | ||
currency: { | ||
name: 'Rupee', | ||
plural: 'Rupees', | ||
symbol: 'Rs', | ||
fractionalUnit: { | ||
name: 'Cent', | ||
plural: 'Cents', | ||
symbol: '', | ||
}, | ||
}, | ||
texts: { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 10000000, value: 'Crore' }, | ||
{ number: 100000, value: 'Lakh' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
], | ||
exactWordsMapping: [{ number: 100, value: 'One Hundred' }], | ||
}; | ||
public texts = { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}; | ||
public numberWordsMapping = [ | ||
{ number: 10000000, value: 'Crore' }, | ||
{ number: 100000, value: 'Lakh' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
]; | ||
} |
@@ -1,58 +0,59 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export class Locale implements LocaleInterface { | ||
public currency = { | ||
name: 'Naira', | ||
plural: 'Naira', | ||
symbol: '₦', | ||
fractionalUnit: { | ||
name: 'Kobo', | ||
plural: 'Kobo', | ||
symbol: '', | ||
export default class Locale implements LocaleInterface { | ||
public config: LocaleConfig = { | ||
currency: { | ||
name: 'Naira', | ||
plural: 'Naira', | ||
symbol: '₦', | ||
fractionalUnit: { | ||
name: 'Kobo', | ||
plural: 'Kobo', | ||
symbol: '', | ||
}, | ||
}, | ||
texts: { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
], | ||
exactWordsMapping: [{ number: 100, value: 'One Hundred' }], | ||
}; | ||
public texts = { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}; | ||
public numberWordsMapping = [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
]; | ||
} |
@@ -1,58 +0,59 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export class Locale implements LocaleInterface { | ||
public currency = { | ||
name: 'Dollar', | ||
plural: 'Dollars', | ||
symbol: '$', | ||
fractionalUnit: { | ||
name: 'Cent', | ||
plural: 'Cents', | ||
symbol: '¢', | ||
export default class Locale implements LocaleInterface { | ||
public config: LocaleConfig = { | ||
currency: { | ||
name: 'Dollar', | ||
plural: 'Dollars', | ||
symbol: '$', | ||
fractionalUnit: { | ||
name: 'Cent', | ||
plural: 'Cents', | ||
symbol: '¢', | ||
}, | ||
}, | ||
texts: { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
], | ||
exactWordsMapping: [{ number: 100, value: 'One Hundred' }], | ||
}; | ||
public texts = { | ||
and: 'And', | ||
minus: 'Minus', | ||
only: 'Only', | ||
point: 'Point', | ||
}; | ||
public numberWordsMapping = [ | ||
{ number: 1000000000000000, value: 'Quadrillion' }, | ||
{ number: 1000000000000, value: 'Trillion' }, | ||
{ number: 1000000000, value: 'Billion' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Thousand' }, | ||
{ number: 100, value: 'Hundred' }, | ||
{ number: 90, value: 'Ninety' }, | ||
{ number: 80, value: 'Eighty' }, | ||
{ number: 70, value: 'Seventy' }, | ||
{ number: 60, value: 'Sixty' }, | ||
{ number: 50, value: 'Fifty' }, | ||
{ number: 40, value: 'Forty' }, | ||
{ number: 30, value: 'Thirty' }, | ||
{ number: 20, value: 'Twenty' }, | ||
{ number: 19, value: 'Nineteen' }, | ||
{ number: 18, value: 'Eighteen' }, | ||
{ number: 17, value: 'Seventeen' }, | ||
{ number: 16, value: 'Sixteen' }, | ||
{ number: 15, value: 'Fifteen' }, | ||
{ number: 14, value: 'Fourteen' }, | ||
{ number: 13, value: 'Thirteen' }, | ||
{ number: 12, value: 'Twelve' }, | ||
{ number: 11, value: 'Eleven' }, | ||
{ number: 10, value: 'Ten' }, | ||
{ number: 9, value: 'Nine' }, | ||
{ number: 8, value: 'Eight' }, | ||
{ number: 7, value: 'Seven' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Five' }, | ||
{ number: 4, value: 'Four' }, | ||
{ number: 3, value: 'Three' }, | ||
{ number: 2, value: 'Two' }, | ||
{ number: 1, value: 'One' }, | ||
{ number: 0, value: 'Zero' }, | ||
]; | ||
} |
@@ -1,84 +0,80 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export class Locale implements LocaleInterface { | ||
public currency = { | ||
name: 'تومان', | ||
plural: '', | ||
symbol: 'تومان', | ||
fractionalUnit: { | ||
name: '', | ||
plural: 'تومان', | ||
symbol: '', | ||
export default class Locale implements LocaleInterface { | ||
public config: LocaleConfig = { | ||
currency: { | ||
name: 'تومان', | ||
plural: '', | ||
symbol: 'تومان', | ||
fractionalUnit: { | ||
name: '', | ||
plural: 'تومان', | ||
symbol: '', | ||
}, | ||
}, | ||
}; | ||
public texts = { | ||
and: 'و', | ||
minus: 'منفی', | ||
only: '', | ||
point: 'و', | ||
}; | ||
public options = { | ||
texts: { | ||
and: 'و', | ||
minus: 'منفی', | ||
only: '', | ||
point: 'و', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 1000000000000000, value: 'کوادریلیون' }, | ||
{ number: 1000000000000, value: 'تیلیارد' }, | ||
{ number: 1000000000, value: 'میلیارد' }, | ||
{ number: 1000000, value: 'میلیون' }, | ||
{ number: 1000, value: 'هزار' }, | ||
{ number: 900, value: 'نهصد' }, | ||
{ number: 800, value: 'هشتصد' }, | ||
{ number: 700, value: 'هفتصد' }, | ||
{ number: 600, value: 'ششصد' }, | ||
{ number: 500, value: 'پانصد' }, | ||
{ number: 400, value: 'چهارصد' }, | ||
{ number: 300, value: 'سیصد' }, | ||
{ number: 200, value: 'دویست' }, | ||
{ number: 100, value: 'صد' }, | ||
{ number: 90, value: 'نود' }, | ||
{ number: 80, value: 'هشتاد' }, | ||
{ number: 70, value: 'هفتاد' }, | ||
{ number: 60, value: 'شصت' }, | ||
{ number: 50, value: 'پنجاه' }, | ||
{ number: 40, value: 'چهل' }, | ||
{ number: 30, value: 'سی' }, | ||
{ number: 20, value: 'بیست' }, | ||
{ number: 19, value: 'نوزده' }, | ||
{ number: 18, value: 'هجده' }, | ||
{ number: 17, value: 'هفده' }, | ||
{ number: 16, value: 'شانزده' }, | ||
{ number: 15, value: 'پانزده' }, | ||
{ number: 14, value: 'چهارده' }, | ||
{ number: 13, value: 'سیزده' }, | ||
{ number: 12, value: 'دوازده' }, | ||
{ number: 11, value: 'یازده' }, | ||
{ number: 10, value: 'ده' }, | ||
{ number: 9, value: 'نه' }, | ||
{ number: 8, value: 'هشت' }, | ||
{ number: 7, value: 'هفت' }, | ||
{ number: 6, value: 'شش' }, | ||
{ number: 5, value: 'پنج' }, | ||
{ number: 4, value: 'چهار' }, | ||
{ number: 3, value: 'سه' }, | ||
{ number: 2, value: 'دو' }, | ||
{ number: 1, value: 'یک' }, | ||
{ number: 0, value: 'صفر' }, | ||
], | ||
namedLessThan1000: true, | ||
splitWord: 'و', | ||
ignoreZeroInDecimals: true, | ||
decimalLengthWordMapping: { | ||
1: 'دهم', | ||
2: 'صدم', | ||
3: 'هزارم', | ||
4: 'دههزارم', | ||
5: 'صدهزارم', | ||
6: 'میلیونیوم', | ||
7: 'دهمیلیونیوم', | ||
8: 'صدمیلیونیوم', | ||
9: 'میلیاردیوم', | ||
}, | ||
}; | ||
public decimalLengthWordMapping = { | ||
1: 'دهم', | ||
2: 'صدم', | ||
3: 'هزارم', | ||
4: 'دههزارم', | ||
5: 'صدهزارم', | ||
6: 'میلیونیوم', | ||
7: 'دهمیلیونیوم', | ||
8: 'صدمیلیونیوم', | ||
9: 'میلیاردیوم', | ||
}; | ||
public numberWordsMapping = [ | ||
{ number: 1000000000000000, value: 'کوادریلیون' }, | ||
{ number: 1000000000000, value: 'تیلیارد' }, | ||
{ number: 1000000000, value: 'میلیارد' }, | ||
{ number: 1000000, value: 'میلیون' }, | ||
{ number: 1000, value: 'هزار' }, | ||
{ number: 900, value: 'نهصد' }, | ||
{ number: 800, value: 'هشتصد' }, | ||
{ number: 700, value: 'هفتصد' }, | ||
{ number: 600, value: 'ششصد' }, | ||
{ number: 500, value: 'پانصد' }, | ||
{ number: 400, value: 'چهارصد' }, | ||
{ number: 300, value: 'سیصد' }, | ||
{ number: 200, value: 'دویست' }, | ||
{ number: 100, value: 'صد' }, | ||
{ number: 90, value: 'نود' }, | ||
{ number: 80, value: 'هشتاد' }, | ||
{ number: 70, value: 'هفتاد' }, | ||
{ number: 60, value: 'شصت' }, | ||
{ number: 50, value: 'پنجاه' }, | ||
{ number: 40, value: 'چهل' }, | ||
{ number: 30, value: 'سی' }, | ||
{ number: 20, value: 'بیست' }, | ||
{ number: 19, value: 'نوزده' }, | ||
{ number: 18, value: 'هجده' }, | ||
{ number: 17, value: 'هفده' }, | ||
{ number: 16, value: 'شانزده' }, | ||
{ number: 15, value: 'پانزده' }, | ||
{ number: 14, value: 'چهارده' }, | ||
{ number: 13, value: 'سیزده' }, | ||
{ number: 12, value: 'دوازده' }, | ||
{ number: 11, value: 'یازده' }, | ||
{ number: 10, value: 'ده' }, | ||
{ number: 9, value: 'نه' }, | ||
{ number: 8, value: 'هشت' }, | ||
{ number: 7, value: 'هفت' }, | ||
{ number: 6, value: 'شش' }, | ||
{ number: 5, value: 'پنج' }, | ||
{ number: 4, value: 'چهار' }, | ||
{ number: 3, value: 'سه' }, | ||
{ number: 2, value: 'دو' }, | ||
{ number: 1, value: 'یک' }, | ||
{ number: 0, value: 'صفر' }, | ||
]; | ||
} |
@@ -1,16 +0,129 @@ | ||
import { LocaleInterface } from './locale.interface'; | ||
import { LocaleConfig, LocaleInterface } from '../types'; | ||
export class Locale implements LocaleInterface { | ||
public currency = { | ||
name: 'Euro', | ||
plural: 'Euros', | ||
symbol: '€', | ||
fractionalUnit: { | ||
name: 'Centime', | ||
plural: 'Centimes', | ||
symbol: 'Cts', | ||
export default class Locale implements LocaleInterface { | ||
public config: LocaleConfig = { | ||
currency: { | ||
name: 'Euro', | ||
plural: 'Euros', | ||
symbol: '€', | ||
fractionalUnit: { | ||
name: 'Centime', | ||
plural: 'Centimes', | ||
symbol: 'Cts', | ||
}, | ||
}, | ||
}; | ||
public options = { | ||
texts: { | ||
and: 'Et', | ||
minus: 'Moins', | ||
only: '', | ||
point: 'Virgule', | ||
}, | ||
numberWordsMapping: [ | ||
{ number: 1000000000000000, value: 'Billiard' }, | ||
{ number: 1000000000000, value: 'Billion' }, | ||
{ number: 1000000000, value: 'Milliard' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Mille' }, | ||
{ number: 100, value: 'Cent' }, | ||
{ number: 99, value: 'Quatre-Vingt-Dix-Neuf' }, | ||
{ number: 98, value: 'Quatre-Vingt-Dix-Huit' }, | ||
{ number: 97, value: 'Quatre-Vingt-Dix-Sept' }, | ||
{ number: 96, value: 'Quatre-Vingt-Seize' }, | ||
{ number: 95, value: 'Quatre-Vingt-Quinze' }, | ||
{ number: 94, value: 'Quatre-Vingt-Quatorze' }, | ||
{ number: 93, value: 'Quatre-Vingt-Treize' }, | ||
{ number: 92, value: 'Quatre-Vingt-Douze' }, | ||
{ number: 91, value: 'Quatre-Vingt-Onze' }, | ||
{ number: 90, value: 'Quatre-Vingt-Dix' }, | ||
{ number: 89, value: 'Quatre-Vingt-Neuf' }, | ||
{ number: 88, value: 'Quatre-Vingt-Huit' }, | ||
{ number: 87, value: 'Quatre-Vingt-Sept' }, | ||
{ number: 86, value: 'Quatre-Vingt-Six' }, | ||
{ number: 85, value: 'Quatre-Vingt-Cinq' }, | ||
{ number: 84, value: 'Quatre-Vingt-Quatre' }, | ||
{ number: 83, value: 'Quatre-Vingt-Trois' }, | ||
{ number: 82, value: 'Quatre-Vingt-Deux' }, | ||
{ number: 81, value: 'Quatre-Vingt-Un' }, | ||
{ number: 80, value: 'Quatre-Vingt' }, | ||
{ number: 79, value: 'Soixante-Dix-Neuf' }, | ||
{ number: 78, value: 'Soixante-Dix-Huit' }, | ||
{ number: 77, value: 'Soixante-Dix-Sept' }, | ||
{ number: 76, value: 'Soixante-Seize' }, | ||
{ number: 75, value: 'Soixante-Quinze' }, | ||
{ number: 74, value: 'Soixante-Quatorze' }, | ||
{ number: 73, value: 'Soixante-Treize' }, | ||
{ number: 72, value: 'Soixante-Douze' }, | ||
{ number: 71, value: 'Soixante Et Onze' }, | ||
{ number: 70, value: 'Soixante-dix' }, | ||
{ number: 69, value: 'Soixante-Neuf' }, | ||
{ number: 68, value: 'Soixante-Huit' }, | ||
{ number: 67, value: 'Soixante-Sept' }, | ||
{ number: 66, value: 'Soixante-Six' }, | ||
{ number: 65, value: 'Soixante-Cinq' }, | ||
{ number: 64, value: 'Soixante-Quatre' }, | ||
{ number: 63, value: 'Soixante-Trois' }, | ||
{ number: 62, value: 'Soixante-Deux' }, | ||
{ number: 61, value: 'Soixante Et Un' }, | ||
{ number: 60, value: 'Soixante' }, | ||
{ number: 59, value: 'Cinquante-Neuf' }, | ||
{ number: 58, value: 'Cinquante-Huit' }, | ||
{ number: 57, value: 'Cinquante-Sept' }, | ||
{ number: 56, value: 'Cinquante-Six' }, | ||
{ number: 55, value: 'Cinquante-Cinq' }, | ||
{ number: 54, value: 'Cinquante-Quatre' }, | ||
{ number: 53, value: 'Cinquante-Trois' }, | ||
{ number: 52, value: 'Cinquante-Deux' }, | ||
{ number: 51, value: 'Cinquante Et Un' }, | ||
{ number: 50, value: 'Cinquante' }, | ||
{ number: 49, value: 'Quarante-Neuf' }, | ||
{ number: 48, value: 'Quarante-Huit' }, | ||
{ number: 47, value: 'Quarante-Sept' }, | ||
{ number: 46, value: 'Quarante-Six' }, | ||
{ number: 45, value: 'Quarante-Cinq' }, | ||
{ number: 44, value: 'Quarante-Quatre' }, | ||
{ number: 43, value: 'Quarante-Trois' }, | ||
{ number: 42, value: 'Quarante-Deux' }, | ||
{ number: 41, value: 'Quarante Et Un' }, | ||
{ number: 40, value: 'Quarante' }, | ||
{ number: 39, value: 'Trente-Neuf' }, | ||
{ number: 38, value: 'Trente-Huit' }, | ||
{ number: 37, value: 'Trente-Sept' }, | ||
{ number: 36, value: 'Trente-Six' }, | ||
{ number: 35, value: 'Trente-Cinq' }, | ||
{ number: 34, value: 'Trente-Quatre' }, | ||
{ number: 33, value: 'Trente-Trois' }, | ||
{ number: 32, value: 'Trente-Deux' }, | ||
{ number: 31, value: 'Trente Et Un' }, | ||
{ number: 30, value: 'Trente' }, | ||
{ number: 29, value: 'Vingt-Neuf' }, | ||
{ number: 28, value: 'Vingt-Huit' }, | ||
{ number: 27, value: 'Vingt-Sept' }, | ||
{ number: 26, value: 'Vingt-Six' }, | ||
{ number: 25, value: 'Vingt-Cinq' }, | ||
{ number: 24, value: 'Vingt-Quatre' }, | ||
{ number: 23, value: 'Vingt-Trois' }, | ||
{ number: 22, value: 'Vingt-Deux' }, | ||
{ number: 21, value: 'Vingt Et Un' }, | ||
{ number: 20, value: 'Vingt' }, | ||
{ number: 19, value: 'Dix-Neuf' }, | ||
{ number: 18, value: 'Dix-Huit' }, | ||
{ number: 17, value: 'Dix-Sept' }, | ||
{ number: 16, value: 'Seize' }, | ||
{ number: 15, value: 'Quinze' }, | ||
{ number: 14, value: 'Quatorze' }, | ||
{ number: 13, value: 'Treize' }, | ||
{ number: 12, value: 'Douze' }, | ||
{ number: 11, value: 'Onze' }, | ||
{ number: 10, value: 'Dix' }, | ||
{ number: 9, value: 'Neuf' }, | ||
{ number: 8, value: 'Huit' }, | ||
{ number: 7, value: 'Sept' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Cinq' }, | ||
{ number: 4, value: 'Quatre' }, | ||
{ number: 3, value: 'Trois' }, | ||
{ number: 2, value: 'Deux' }, | ||
{ number: 1, value: 'Un' }, | ||
{ number: 0, value: 'Zéro' }, | ||
], | ||
ignoreOneForWords: ['Cent', 'Mille'], | ||
@@ -20,118 +133,2 @@ pluralMark: 's', | ||
}; | ||
public texts = { | ||
and: 'Et', | ||
minus: 'Moins', | ||
only: '', | ||
point: 'Virgule', | ||
}; | ||
public numberWordsMapping = [ | ||
{ number: 1000000000000000, value: 'Billiard' }, | ||
{ number: 1000000000000, value: 'Billion' }, | ||
{ number: 1000000000, value: 'Milliard' }, | ||
{ number: 1000000, value: 'Million' }, | ||
{ number: 1000, value: 'Mille' }, | ||
{ number: 100, value: 'Cent' }, | ||
{ number: 99, value: 'Quatre-Vingt-Dix-Neuf' }, | ||
{ number: 98, value: 'Quatre-Vingt-Dix-Huit' }, | ||
{ number: 97, value: 'Quatre-Vingt-Dix-Sept' }, | ||
{ number: 96, value: 'Quatre-Vingt-Seize' }, | ||
{ number: 95, value: 'Quatre-Vingt-Quinze' }, | ||
{ number: 94, value: 'Quatre-Vingt-Quatorze' }, | ||
{ number: 93, value: 'Quatre-Vingt-Treize' }, | ||
{ number: 92, value: 'Quatre-Vingt-Douze' }, | ||
{ number: 91, value: 'Quatre-Vingt-Onze' }, | ||
{ number: 90, value: 'Quatre-Vingt-Dix' }, | ||
{ number: 89, value: 'Quatre-Vingt-Neuf' }, | ||
{ number: 88, value: 'Quatre-Vingt-Huit' }, | ||
{ number: 87, value: 'Quatre-Vingt-Sept' }, | ||
{ number: 86, value: 'Quatre-Vingt-Six' }, | ||
{ number: 85, value: 'Quatre-Vingt-Cinq' }, | ||
{ number: 84, value: 'Quatre-Vingt-Quatre' }, | ||
{ number: 83, value: 'Quatre-Vingt-Trois' }, | ||
{ number: 82, value: 'Quatre-Vingt-Deux' }, | ||
{ number: 81, value: 'Quatre-Vingt-Un' }, | ||
{ number: 80, value: 'Quatre-Vingt' }, | ||
{ number: 79, value: 'Soixante-Dix-Neuf' }, | ||
{ number: 78, value: 'Soixante-Dix-Huit' }, | ||
{ number: 77, value: 'Soixante-Dix-Sept' }, | ||
{ number: 76, value: 'Soixante-Seize' }, | ||
{ number: 75, value: 'Soixante-Quinze' }, | ||
{ number: 74, value: 'Soixante-Quatorze' }, | ||
{ number: 73, value: 'Soixante-Treize' }, | ||
{ number: 72, value: 'Soixante-Douze' }, | ||
{ number: 71, value: 'Soixante Et Onze' }, | ||
{ number: 70, value: 'Soixante-dix' }, | ||
{ number: 69, value: 'Soixante-Neuf' }, | ||
{ number: 68, value: 'Soixante-Huit' }, | ||
{ number: 67, value: 'Soixante-Sept' }, | ||
{ number: 66, value: 'Soixante-Six' }, | ||
{ number: 65, value: 'Soixante-Cinq' }, | ||
{ number: 64, value: 'Soixante-Quatre' }, | ||
{ number: 63, value: 'Soixante-Trois' }, | ||
{ number: 62, value: 'Soixante-Deux' }, | ||
{ number: 61, value: 'Soixante Et Un' }, | ||
{ number: 60, value: 'Soixante' }, | ||
{ number: 59, value: 'Cinquante-Neuf' }, | ||
{ number: 58, value: 'Cinquante-Huit' }, | ||
{ number: 57, value: 'Cinquante-Sept' }, | ||
{ number: 56, value: 'Cinquante-Six' }, | ||
{ number: 55, value: 'Cinquante-Cinq' }, | ||
{ number: 54, value: 'Cinquante-Quatre' }, | ||
{ number: 53, value: 'Cinquante-Trois' }, | ||
{ number: 52, value: 'Cinquante-Deux' }, | ||
{ number: 51, value: 'Cinquante Et Un' }, | ||
{ number: 50, value: 'Cinquante' }, | ||
{ number: 49, value: 'Quarante-Neuf' }, | ||
{ number: 48, value: 'Quarante-Huit' }, | ||
{ number: 47, value: 'Quarante-Sept' }, | ||
{ number: 46, value: 'Quarante-Six' }, | ||
{ number: 45, value: 'Quarante-Cinq' }, | ||
{ number: 44, value: 'Quarante-Quatre' }, | ||
{ number: 43, value: 'Quarante-Trois' }, | ||
{ number: 42, value: 'Quarante-Deux' }, | ||
{ number: 41, value: 'Quarante Et Un' }, | ||
{ number: 40, value: 'Quarante' }, | ||
{ number: 39, value: 'Trente-Neuf' }, | ||
{ number: 38, value: 'Trente-Huit' }, | ||
{ number: 37, value: 'Trente-Sept' }, | ||
{ number: 36, value: 'Trente-Six' }, | ||
{ number: 35, value: 'Trente-Cinq' }, | ||
{ number: 34, value: 'Trente-Quatre' }, | ||
{ number: 33, value: 'Trente-Trois' }, | ||
{ number: 32, value: 'Trente-Deux' }, | ||
{ number: 31, value: 'Trente Et Un' }, | ||
{ number: 30, value: 'Trente' }, | ||
{ number: 29, value: 'Vingt-Neuf' }, | ||
{ number: 28, value: 'Vingt-Huit' }, | ||
{ number: 27, value: 'Vingt-Sept' }, | ||
{ number: 26, value: 'Vingt-Six' }, | ||
{ number: 25, value: 'Vingt-Cinq' }, | ||
{ number: 24, value: 'Vingt-Quatre' }, | ||
{ number: 23, value: 'Vingt-Trois' }, | ||
{ number: 22, value: 'Vingt-Deux' }, | ||
{ number: 21, value: 'Vingt Et Un' }, | ||
{ number: 20, value: 'Vingt' }, | ||
{ number: 19, value: 'Dix-Neuf' }, | ||
{ number: 18, value: 'Dix-Huit' }, | ||
{ number: 17, value: 'Dix-Sept' }, | ||
{ number: 16, value: 'Seize' }, | ||
{ number: 15, value: 'Quinze' }, | ||
{ number: 14, value: 'Quatorze' }, | ||
{ number: 13, value: 'Treize' }, | ||
{ number: 12, value: 'Douze' }, | ||
{ number: 11, value: 'Onze' }, | ||
{ number: 10, value: 'Dix' }, | ||
{ number: 9, value: 'Neuf' }, | ||
{ number: 8, value: 'Huit' }, | ||
{ number: 7, value: 'Sept' }, | ||
{ number: 6, value: 'Six' }, | ||
{ number: 5, value: 'Cinq' }, | ||
{ number: 4, value: 'Quatre' }, | ||
{ number: 3, value: 'Trois' }, | ||
{ number: 2, value: 'Deux' }, | ||
{ number: 1, value: 'Un' }, | ||
{ number: 0, value: 'Zéro' }, | ||
]; | ||
} |
{ | ||
"compilerOptions": { | ||
"target": "es6", | ||
"target": "ES2019", | ||
"module": "commonjs", | ||
@@ -5,0 +5,0 @@ "outDir": "./dist", |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
206699
68
4738
112
25
2