Comparing version 1.2.0 to 1.2.2
10
index.js
@@ -9,3 +9,3 @@ /* eslint-disable eqeqeq */ | ||
const getLT20 = (n) => a[Number(n)] | ||
const get20Plus = (n) => b[n[0]] + ' ' + a[n[1]] | ||
const getGT20 = (n) => b[n[0]] + ' ' + a[n[1]] | ||
@@ -25,10 +25,10 @@ module.exports = function numWords (input) { | ||
let str = '' | ||
str += n1 != 0 ? (getLT20(n1) || get20Plus(n1)) + 'crore ' : '' | ||
str += n2 != 0 ? (getLT20(n2) || get20Plus(n2)) + 'lakh ' : '' | ||
str += n3 != 0 ? (getLT20(n3) || get20Plus(n3)) + 'thousand ' : '' | ||
str += n1 != 0 ? (getLT20(n1) || getGT20(n1)) + 'crore ' : '' | ||
str += n2 != 0 ? (getLT20(n2) || getGT20(n2)) + 'lakh ' : '' | ||
str += n3 != 0 ? (getLT20(n3) || getGT20(n3)) + 'thousand ' : '' | ||
str += n4 != 0 ? getLT20(n4) + 'hundred ' : '' | ||
str += n5 != 0 && str != '' ? 'and ' : '' | ||
str += n5 != 0 ? (getLT20(n5) || get20Plus(n5)) : '' | ||
str += n5 != 0 ? (getLT20(n5) || getGT20(n5)) : '' | ||
return str.trim() | ||
} |
{ | ||
"name": "num-words", | ||
"version": "1.2.0", | ||
"version": "1.2.2", | ||
"description": "Convert digits to words", | ||
@@ -23,5 +23,5 @@ "main": "index.js", | ||
"devDependencies": { | ||
"standard": "^14.3.3", | ||
"standard": "^16.0.3", | ||
"tap": "^14.10.7" | ||
} | ||
} |
# num-words | ||
An simple module to convert numbers to words for South Asian numbering system. e.g. Two crore four lakh | ||
An simple module to convert numbers to words for South Asian numbering system. e.g. Two crore four lakh. | ||
# Install | ||
```javascript | ||
```js | ||
npm i num-words | ||
@@ -13,3 +13,3 @@ ``` | ||
```javascript | ||
```js | ||
1 -> one | ||
@@ -25,3 +25,3 @@ 12 -> twelve | ||
```javascript | ||
```js | ||
const numWords = require('num-words') | ||
@@ -28,0 +28,0 @@ |
Sorry, the diff of this file is not supported yet
11217
8