Socket
Socket
Sign inDemoInstall

react-currency-input-field

Package Overview
Dependencies
3
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.6.10 to 3.6.11

6

dist/index.esm.js

@@ -121,3 +121,3 @@ import React, { forwardRef, useMemo, useState, useRef, useImperativeHandle, useEffect } from 'react';

// disallow letter without number
if (abbreviations.some(function (letter) { return letter === withoutInvalidChars.toLowerCase(); })) {
if (abbreviations.some(function (letter) { return letter === withoutInvalidChars.toLowerCase().replace(decimalSeparator, ''); })) {
return '';

@@ -422,2 +422,4 @@ }

setStateValue(stringValue);
// Always sets cursor after '-' or decimalSeparator input
setCursor(1);
return;

@@ -470,3 +472,3 @@ }

var valueOnly = cleanValue(__assign({ value: value }, cleanValueOptions));
if (valueOnly === '-' || !valueOnly) {
if (valueOnly === '-' || valueOnly === decimalSeparator || !valueOnly) {
setStateValue('');

@@ -473,0 +475,0 @@ onBlur && onBlur(event);

@@ -129,3 +129,3 @@ (function (global, factory) {

// disallow letter without number
if (abbreviations.some(function (letter) { return letter === withoutInvalidChars.toLowerCase(); })) {
if (abbreviations.some(function (letter) { return letter === withoutInvalidChars.toLowerCase().replace(decimalSeparator, ''); })) {
return '';

@@ -430,2 +430,4 @@ }

setStateValue(stringValue);
// Always sets cursor after '-' or decimalSeparator input
setCursor(1);
return;

@@ -478,3 +480,3 @@ }

var valueOnly = cleanValue(__assign({ value: value }, cleanValueOptions));
if (valueOnly === '-' || !valueOnly) {
if (valueOnly === '-' || valueOnly === decimalSeparator || !valueOnly) {
setStateValue('');

@@ -481,0 +483,0 @@ onBlur && onBlur(event);

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

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

@@ -212,3 +212,3 @@ import { cleanValue } from '../cleanValue';

value: 'k',
disableAbbreviations: true,
disableAbbreviations: false,
})

@@ -220,3 +220,3 @@ ).toEqual('');

value: 'm',
disableAbbreviations: true,
disableAbbreviations: false,
})

@@ -228,3 +228,3 @@ ).toEqual('');

value: 'b',
disableAbbreviations: true,
disableAbbreviations: false,
})

@@ -239,3 +239,3 @@ ).toEqual('');

prefix: '$',
disableAbbreviations: true,
disableAbbreviations: false,
})

@@ -248,3 +248,3 @@ ).toEqual('');

prefix: '£',
disableAbbreviations: true,
disableAbbreviations: false,
})

@@ -254,2 +254,23 @@ ).toEqual('');

it('should return empty string if decimal separator and abbreviation only', () => {
expect(
cleanValue({
value: '.k',
})
).toEqual('');
expect(
cleanValue({
value: '.m',
})
).toEqual('');
expect(
cleanValue({
value: '£.m',
prefix: '£',
})
).toEqual('');
});
it('should ignore abbreviations if disableAbbreviations is true', () => {

@@ -256,0 +277,0 @@ expect(

@@ -61,3 +61,7 @@ import { parseAbbrValue } from './parseAbbrValue';

// disallow letter without number
if (abbreviations.some((letter) => letter === withoutInvalidChars.toLowerCase())) {
if (
abbreviations.some(
(letter) => letter === withoutInvalidChars.toLowerCase().replace(decimalSeparator, '')
)
) {
return '';

@@ -64,0 +68,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc