Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

to-words

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

to-words - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

4

__tests__/en-IN.spec.ts

@@ -37,3 +37,3 @@ import { ToWords } from '../src/to-words';

row[0] = -row[0];
row[1] = 'Minus ' + row[1];
row[1] = `Minus ${row[1]}`;
});

@@ -49,3 +49,3 @@

testIntegersWithCurrency.map((row) => {
row[1] = row[1] + ` Rupees Only`
row[1] = `${row[1]} Rupees Only`;
});

@@ -52,0 +52,0 @@

@@ -37,3 +37,3 @@ import { ToWords } from '../src/to-words';

row[0] = -row[0];
row[1] = 'Minus ' + row[1];
row[1] = `Minus ${row[1]}`;
});

@@ -49,3 +49,3 @@

testIntegersWithCurrency.map((row) => {
row[1] = row[1] + ` Dollars Only`
row[1] = `${row[1]} Dollars Only`;
});

@@ -52,0 +52,0 @@

@@ -17,2 +17,5 @@ module.exports = {

},
rules: {
'prefer-template': 'error',
}
};

@@ -5,2 +5,9 @@ # Changelog

### [2.0.2](https://github.com/mastermunj/to-words/compare/v2.0.1...v2.0.2) (2020-04-24)
### Bug Fixes
* lint rules ([74bfb9c](https://github.com/mastermunj/to-words/commit/74bfb9c8b91eda02dbcde9596b61d9de67737355))
### [2.0.1](https://github.com/mastermunj/to-words/compare/v2.0.0...v2.0.1) (2020-04-23)

@@ -7,0 +14,0 @@

{
"name": "to-words",
"version": "2.0.1",
"version": "2.0.2",
"description": "Converts numbers (including decimal points) into words & currency.",

@@ -5,0 +5,0 @@ "main": "dist/to-words.js",

@@ -76,4 +76,4 @@ import { LocaleInterface } from './locales/locale.interface';

const isNumberZero = number >= 0 && number < 1;
const split = (number + '').split('.');
let words = this.convertInternal(Number(split[0]), options) + ` ${locale.currency.plural}`;
const split = (number.toString()).split('.');
let words = `${this.convertInternal(Number(split[0]), options)} ${locale.currency.plural}`;

@@ -89,3 +89,3 @@ if (isNumberZero && options.ignoreZeroCurrency) {

}
wordsWithDecimal += this.convertInternal(Number(split[1]) * Math.pow(10, 2 - split[1].length), options) + ` ${locale.currency.fractionalUnit.plural}`;
wordsWithDecimal += `${this.convertInternal(Number(split[1]) * Math.pow(10, 2 - split[1].length), options)} ${locale.currency.fractionalUnit.plural}`;
}

@@ -95,3 +95,3 @@ const isEmpty = words.length <= 0 && wordsWithDecimal.length <= 0;

} else {
const split = (number + '').split('.');
const split = (number.toString()).split('.');

@@ -132,3 +132,3 @@ const words = this.convertInternal(Number(split[0]), options);

if (number > 0) {
words += ' ' + this.convertInternal(number, options);
words += ` ${this.convertInternal(number, options)}`;
}

@@ -139,6 +139,5 @@ } else {

if (remainder > 0) {
return this.convertInternal(quotient, options) + ' '
+ match.value + ' ' + this.convertInternal(remainder, options);
return `${this.convertInternal(quotient, options)} ${match.value} ${this.convertInternal(remainder, options)}`
} else {
return this.convertInternal(quotient, options) + ' ' + match.value;
return `${this.convertInternal(quotient, options)} ${match.value}`;
}

@@ -145,0 +144,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc