redux-freeform 5.8.2-beta.3 → 5.8.2-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,6 +75,11 @@ const IS_CURRENCY = 'validator/IS_CURRENCY';
75
75
  const IS_CURRENCY_ERROR = 'error/IS_CURRENCY';
76
76
  const isCurrency = createValidator(IS_CURRENCY, IS_CURRENCY_ERROR);
77
77
  validatorFns[IS_CURRENCY] = (value, args, form) => {
78
+ // Check for any non numbers, periods, or a dollar sign at the beginning
79
+ const containsNonNumbers = /^(?:\$)?[^0-9\s.]+/;
80
+ if (containsNonNumbers.test(value)) {
81
+ return false;
82
+ }
78
83
  const parts = value.split('.');
79
84
  if (parts.length > 2) {
80
85
  return false;
@@ -71,6 +71,11 @@ const IS_CURRENCY = 'validator/IS_CURRENCY';
71
71
  const IS_CURRENCY_ERROR = 'error/IS_CURRENCY';
72
72
  const isCurrency = createValidator(IS_CURRENCY, IS_CURRENCY_ERROR);
73
73
  validatorFns[IS_CURRENCY] = (value, args, form) => {
74
+ // Check for any non numbers, periods, or a dollar sign at the beginning
75
+ const containsNonNumbers = /^(?:\$)?[^0-9\s.]+/;
76
+ if (containsNonNumbers.test(value)) {
77
+ return false;
78
+ }
74
79
  const parts = value.split('.');
75
80
  if (parts.length > 2) {
76
81
  return false;
@@ -77,6 +77,11 @@
77
77
  const IS_CURRENCY_ERROR = 'error/IS_CURRENCY';
78
78
  const isCurrency = createValidator(IS_CURRENCY, IS_CURRENCY_ERROR);
79
79
  validatorFns[IS_CURRENCY] = (value, args, form) => {
80
+ // Check for any non numbers, periods, or a dollar sign at the beginning
81
+ const containsNonNumbers = /^(?:\$)?[^0-9\s.]+/;
82
+ if (containsNonNumbers.test(value)) {
83
+ return false;
84
+ }
80
85
  const parts = value.split('.');
81
86
  if (parts.length > 2) {
82
87
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redux-freeform",
3
- "version": "5.8.2-beta.3",
3
+ "version": "5.8.2-beta.5",
4
4
  "description": "A small Redux form library that supports purely functional apps, without magic",
5
5
  "main": "dist/redux-freeform.cjs.js",
6
6
  "module": "dist/redux-freeform.esm.js",