Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

intl-number-input

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.1.1

18

dist/index.cjs.js
/**
* Intl Number Input 1.1.0
* Intl Number Input 1.1.1
* (c) 2021 Matthias Stiller

@@ -92,7 +92,9 @@ * @license MIT

if (match && this.isValidIntegerFormat(this.decimalSymbol ? str.split(this.decimalSymbol)[0] : str, Number(match[1]))) {
let number = Number(`${negative ? '-' : ''}${this.onlyDigits(match[1])}.${this.onlyDigits(match[2] || '')}`);
const number = Number(`${negative ? '-' : ''}${this.onlyDigits(match[1])}.${this.onlyDigits(match[2] || '')}`);
if (this.style === exports.NumberFormatStyle.Percent) {
number /= 100;
return Number((number / 100).toFixed(this.maximumFractionDigits + 2));
}
return number;
else {
return number;
}
}

@@ -225,3 +227,3 @@ }

}
class AutoDecimalModeNumberMask extends AbstractNumberMask {
class AutoDecimalDigitsNumberMask extends AbstractNumberMask {
conformToMask(str, previousConformedValue = '') {

@@ -236,6 +238,6 @@ if (str === '' ||

? -0
: Number(`${negative ? '-' : ''}${removeLeadingZeros(this.numberFormat.onlyDigits(str))}`) / Math.pow(10, this.numberFormat.minimumFractionDigits);
: Number(`${negative ? '-' : ''}${removeLeadingZeros(this.numberFormat.onlyDigits(str))}`) / Math.pow(10, this.numberFormat.maximumFractionDigits);
return {
numberValue,
fractionDigits: numberValue.toFixed(this.numberFormat.minimumFractionDigits).slice(-this.numberFormat.minimumFractionDigits)
fractionDigits: numberValue.toFixed(this.numberFormat.maximumFractionDigits).slice(-this.numberFormat.maximumFractionDigits)
};

@@ -292,3 +294,3 @@ }

this.numberFormat = new NumberFormat(this.options);
this.numberMask = this.options.autoDecimalDigits ? new AutoDecimalModeNumberMask(this.numberFormat) : new DefaultNumberMask(this.numberFormat);
this.numberMask = this.options.autoDecimalDigits ? new AutoDecimalDigitsNumberMask(this.numberFormat) : new DefaultNumberMask(this.numberFormat);
this.step = options.step && options.step > 0 ? Math.max(options.step, this.toFloat(1)) : this.toFloat(1);

@@ -295,0 +297,0 @@ this.minValue = this.getMinValue();

@@ -0,0 +0,0 @@ interface NumberInputConstructorArgs {

/**
* Intl Number Input 1.1.0
* Intl Number Input 1.1.1
* (c) 2021 Matthias Stiller

@@ -88,7 +88,9 @@ * @license MIT

if (match && this.isValidIntegerFormat(this.decimalSymbol ? str.split(this.decimalSymbol)[0] : str, Number(match[1]))) {
let number = Number(`${negative ? '-' : ''}${this.onlyDigits(match[1])}.${this.onlyDigits(match[2] || '')}`);
const number = Number(`${negative ? '-' : ''}${this.onlyDigits(match[1])}.${this.onlyDigits(match[2] || '')}`);
if (this.style === NumberFormatStyle.Percent) {
number /= 100;
return Number((number / 100).toFixed(this.maximumFractionDigits + 2));
}
return number;
else {
return number;
}
}

@@ -221,3 +223,3 @@ }

}
class AutoDecimalModeNumberMask extends AbstractNumberMask {
class AutoDecimalDigitsNumberMask extends AbstractNumberMask {
conformToMask(str, previousConformedValue = '') {

@@ -232,6 +234,6 @@ if (str === '' ||

? -0
: Number(`${negative ? '-' : ''}${removeLeadingZeros(this.numberFormat.onlyDigits(str))}`) / Math.pow(10, this.numberFormat.minimumFractionDigits);
: Number(`${negative ? '-' : ''}${removeLeadingZeros(this.numberFormat.onlyDigits(str))}`) / Math.pow(10, this.numberFormat.maximumFractionDigits);
return {
numberValue,
fractionDigits: numberValue.toFixed(this.numberFormat.minimumFractionDigits).slice(-this.numberFormat.minimumFractionDigits)
fractionDigits: numberValue.toFixed(this.numberFormat.maximumFractionDigits).slice(-this.numberFormat.maximumFractionDigits)
};

@@ -288,3 +290,3 @@ }

this.numberFormat = new NumberFormat(this.options);
this.numberMask = this.options.autoDecimalDigits ? new AutoDecimalModeNumberMask(this.numberFormat) : new DefaultNumberMask(this.numberFormat);
this.numberMask = this.options.autoDecimalDigits ? new AutoDecimalDigitsNumberMask(this.numberFormat) : new DefaultNumberMask(this.numberFormat);
this.step = options.step && options.step > 0 ? Math.max(options.step, this.toFloat(1)) : this.toFloat(1);

@@ -291,0 +293,0 @@ this.minValue = this.getMinValue();

{
"name": "intl-number-input",
"description": "Easy input of formatted numbers based on the ECMAScript Internationalization API (ECMA-402).",
"version": "1.1.0",
"version": "1.1.1",
"license": "MIT",

@@ -6,0 +6,0 @@ "module": "./dist/index.esm.js",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc