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

react-currency-input-field

Package Overview
Dependencies
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-currency-input-field - npm Package Compare versions

Comparing version 3.6.5 to 3.6.6

17

dist/index.esm.js

@@ -181,15 +181,10 @@ import React, { forwardRef, useMemo, useState, useRef, useEffect } from 'react';

: _value;
var defaultNumberFormatOptions = {
minimumFractionDigits: decimalScale || 0,
maximumFractionDigits: 20,
};
var numberFormatter = intlConfig
? new Intl.NumberFormat(intlConfig.locale, intlConfig.currency
? {
style: 'currency',
currency: intlConfig.currency,
minimumFractionDigits: decimalScale || 0,
maximumFractionDigits: 20,
}
: undefined)
: new Intl.NumberFormat(undefined, {
minimumFractionDigits: decimalScale || 0,
maximumFractionDigits: 20,
});
? __assign(__assign({}, defaultNumberFormatOptions), { style: 'currency', currency: intlConfig.currency }) : defaultNumberFormatOptions)
: new Intl.NumberFormat(undefined, defaultNumberFormatOptions);
var parts = numberFormatter.formatToParts(Number(value));

@@ -196,0 +191,0 @@ var formatted = replaceParts(parts, options);

@@ -189,15 +189,10 @@ (function (global, factory) {

: _value;
var defaultNumberFormatOptions = {
minimumFractionDigits: decimalScale || 0,
maximumFractionDigits: 20,
};
var numberFormatter = intlConfig
? new Intl.NumberFormat(intlConfig.locale, intlConfig.currency
? {
style: 'currency',
currency: intlConfig.currency,
minimumFractionDigits: decimalScale || 0,
maximumFractionDigits: 20,
}
: undefined)
: new Intl.NumberFormat(undefined, {
minimumFractionDigits: decimalScale || 0,
maximumFractionDigits: 20,
});
? __assign(__assign({}, defaultNumberFormatOptions), { style: 'currency', currency: intlConfig.currency }) : defaultNumberFormatOptions)
: new Intl.NumberFormat(undefined, defaultNumberFormatOptions);
var parts = numberFormatter.formatToParts(Number(value));

@@ -204,0 +199,0 @@ var formatted = replaceParts(parts, options);

{
"name": "react-currency-input-field",
"version": "3.6.5",
"version": "3.6.6",
"description": "React <input/> component for formatting currency and numbers.",

@@ -5,0 +5,0 @@ "files": [

@@ -519,3 +519,23 @@ import { formatValue } from '../formatValue';

});
it('should add decimals if intlConfig has no currency provided, decimalScale defined and the input value is X.00', () => {
expect(
formatValue({
value: '123.00',
intlConfig: { locale: 'en-US' },
decimalScale: 2,
})
).toEqual(`123.00`);
});
it('should add decimals if intlConfig has no currency provided, decimalScale defined and the input value is X.00 (de-DE)', () => {
expect(
formatValue({
value: '123.00',
intlConfig: { locale: 'de-DE' },
decimalScale: 2,
})
).toEqual(`123,00`);
});
});
});

@@ -87,2 +87,7 @@ import { IntlConfig } from '../CurrencyInputProps';

const defaultNumberFormatOptions = {
minimumFractionDigits: decimalScale || 0,
maximumFractionDigits: 20,
};
const numberFormatter = intlConfig

@@ -93,13 +98,9 @@ ? new Intl.NumberFormat(

? {
...defaultNumberFormatOptions,
style: 'currency',
currency: intlConfig.currency,
minimumFractionDigits: decimalScale || 0,
maximumFractionDigits: 20,
}
: undefined
: defaultNumberFormatOptions
)
: new Intl.NumberFormat(undefined, {
minimumFractionDigits: decimalScale || 0,
maximumFractionDigits: 20,
});
: new Intl.NumberFormat(undefined, defaultNumberFormatOptions);

@@ -106,0 +107,0 @@ const parts = numberFormatter.formatToParts(Number(value));

Sorry, the diff of this file is not supported yet

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