currency-in-words
Advanced tools
Comparing version 2.3.3 to 2.3.4
@@ -74,2 +74,6 @@ import { convert } from '../src/index' | ||
}) | ||
it('returns "five hundred fifty five" when given the input 555', () => { | ||
const result = convert('00100') | ||
expect(result).toEqual('one hundred') | ||
}) | ||
it('returns "seventy seven thousand two hundred eighty nine" when given the input 77,289', () => { | ||
@@ -93,3 +97,3 @@ const result = convert('77289') | ||
() => { | ||
const result = convert('100000000000000').trim() | ||
const result = convert('100000000000000') | ||
expect(result).toBe('one crore crore') | ||
@@ -99,3 +103,3 @@ }) | ||
() => { | ||
const result = convert('999999999999999').trim() | ||
const result = convert('999999999999999') | ||
expect(result).toBe('nine crore ninety nine lakh ninety nine thousand nine hundred ninety nine crore ninety nine lakh ninety nine thousand nine hundred ninety nine') | ||
@@ -102,0 +106,0 @@ }) |
@@ -0,4 +1,16 @@ | ||
- 2.3.4 | ||
- Merge branch 'develop' | ||
- chores: updated README.md | ||
- 2.3.3 | ||
- merge: merged develop into main and resolved conflicts | ||
- 2.2.3 | ||
- fix: updated tsconfig.json, fixed types and minor bugs | ||
- 2.2.3 | ||
- Merge branch 'develop' merge: merged develop into main | ||
- chores: Added changelogs | ||
- refactor: Added comments for maintainability and refactored code | ||
- Merge branch 'develop' | ||
- 2.1.3 | ||
- chores: omitting tests from build | ||
- merge: merged develop into main and resolved conflicts | ||
- 2.1.0 | ||
@@ -11,5 +23,9 @@ - chores: error handling and misc updates | ||
- 2.0.2 | ||
- merge: merged branch -develop into -main and resolved conflicts | ||
- 2.0.2 | ||
- 2.0.1 | ||
- chores: misc updated for readme | ||
- refactor: misc cleanups | ||
- 2.0.1 | ||
- hot: updated keywords in package.json | ||
- 2.0.0 | ||
@@ -16,0 +32,0 @@ - feat: Added international-system, supporting test cases and updates |
{ | ||
"name": "currency-in-words", | ||
"version": "2.3.3", | ||
"version": "2.3.4", | ||
"description": "A light-weight, fast and efficient lib that converts currency or any numbers to corresponding words", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -21,32 +21,32 @@ # currency-in-words | ||
/* | ||
* format: 'intl' | 'in' | ||
* lang: 'en' | ||
* IOptions { | ||
* format?: 'intl' | 'in' | ||
* lang?: 'en' | ||
* } | ||
* | ||
* convert: (string, { format: string, lang: string }) => string | ||
* convert(value: string, {format: 'intl', lang: 'en'}?: IOptions) => string | ||
*/ | ||
// indian-system | ||
const result = convert('777') | ||
const inWords1 = convert('555.77') | ||
// international-system | ||
const result = convert('777', { format: 'intl' }) seven | ||
const inWords2 = convert('777.55', { format: 'intl' }) | ||
``` | ||
```javascript | ||
console.log('777') // seven hundred seventy seven | ||
console.log('1022') // one thousand twenty two | ||
console.log('1,022') // NaN | ||
console.log('66.123') // sixty six.twelve | ||
console.log('99.11') // ninety nine.eleven | ||
console.log('99.09') // ninety nine; decimals lesser than .10 is rejected | ||
console.log(convert('555')) // five hundred fifty five | ||
console.log(convert('1022')) // one thousand twenty two | ||
console.log(convert('1,022')) // NaN | ||
console.log(convert('66.123')) // sixty six.twelve | ||
console.log(convert('99.11')) // ninety nine.eleven | ||
console.log(convert('99.09')) // ninety nine; decimals lesser than .10 is rejected | ||
console.log('100000') // one lakh | ||
console.log('100000', { format: 'int' }) // one hundred thousand | ||
console.log(convert(100000)) // one lakh | ||
console.log(convert(100000, { format: 'int' })) // one hundred thousand | ||
``` | ||
> *Note* | ||
> 1. Expect ```NaN``` when ',' is present, eg: '100,000.99' | ||
> 2. Expect ```NaN``` when any invalid characters are present, eg: 10E55 | ||
> 3. Fractional part is corrected to two places | ||
> 4. Decimals from .00 to .09 is ignored. | ||
> 5. However, visit [Hacks](#hack) to learn how to handle these limitations | ||
> 1. Expect ```NaN``` when any invalid characters are present, eg: 10E55 | ||
> 2. Fractional part is corrected to two decimal places | ||
> 3. Decimals from .00 to .09 is ignored. | ||
@@ -60,3 +60,3 @@ <br> | ||
eg: calling convert with 100,000,000,000,000 * 10 will throw a range error | ||
eg: calling convert with <bold>999,999,999,999,999 + 1</bold> will throw a range error | ||
@@ -63,0 +63,0 @@ ```java |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
52781
1057
0