redux-freeform 5.8.2-beta.4 → 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.
@@ -71,12 +71,12 @@ dayjs.extend(isSameOrAfter);
71
71
 
72
72
  let validatorFns = {};
73
73
 
74
- const IS_DECIMAL = 'validator/IS_DECIMAL';
75
- const IS_DECIMAL_ERROR = 'error/IS_DECIMAL';
76
- const isCurrency = createValidator(IS_DECIMAL, IS_DECIMAL_ERROR);
77
- validatorFns[IS_DECIMAL] = (value, args, form) => {
78
- // Check for any characters that are not numbers or periods
79
- const containsNonNumbers = /[^0-9\s.]/;
74
+ const IS_CURRENCY = 'validator/IS_CURRENCY';
75
+ const IS_CURRENCY_ERROR = 'error/IS_CURRENCY';
76
+ const isCurrency = createValidator(IS_CURRENCY, IS_CURRENCY_ERROR);
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
80
  if (containsNonNumbers.test(value)) {
81
81
  return false;
82
82
  }
@@ -67,12 +67,12 @@ dayjs.extend(isSameOrAfter);
67
67
 
68
68
  let validatorFns = {};
69
69
 
70
- const IS_DECIMAL = 'validator/IS_DECIMAL';
71
- const IS_DECIMAL_ERROR = 'error/IS_DECIMAL';
72
- const isCurrency = createValidator(IS_DECIMAL, IS_DECIMAL_ERROR);
73
- validatorFns[IS_DECIMAL] = (value, args, form) => {
74
- // Check for any characters that are not numbers or periods
75
- const containsNonNumbers = /[^0-9\s.]/;
70
+ const IS_CURRENCY = 'validator/IS_CURRENCY';
71
+ const IS_CURRENCY_ERROR = 'error/IS_CURRENCY';
72
+ const isCurrency = createValidator(IS_CURRENCY, IS_CURRENCY_ERROR);
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
76
  if (containsNonNumbers.test(value)) {
77
77
  return false;
78
78
  }
@@ -73,12 +73,12 @@
73
73
 
74
74
  let validatorFns = {};
75
75
 
76
- const IS_DECIMAL = 'validator/IS_DECIMAL';
77
- const IS_DECIMAL_ERROR = 'error/IS_DECIMAL';
78
- const isCurrency = createValidator(IS_DECIMAL, IS_DECIMAL_ERROR);
79
- validatorFns[IS_DECIMAL] = (value, args, form) => {
80
- // Check for any characters that are not numbers or periods
81
- const containsNonNumbers = /[^0-9\s.]/;
76
+ const IS_CURRENCY = 'validator/IS_CURRENCY';
77
+ const IS_CURRENCY_ERROR = 'error/IS_CURRENCY';
78
+ const isCurrency = createValidator(IS_CURRENCY, IS_CURRENCY_ERROR);
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
82
  if (containsNonNumbers.test(value)) {
83
83
  return false;
84
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redux-freeform",
3
- "version": "5.8.2-beta.4",
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",