redux-freeform 6.2.2 → 6.2.3

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.
@@ -206,6 +206,19 @@ validatorFns[INCLUDES_POTENTIAL_CARD_NUMBER] = (value) => {
206
206
  return !(luhnValid(value) && regex.test(value));
207
207
  };
208
208
 
209
+ const IS_VALID_CARD_NUMBER = 'validator/IS_VALID_CARD_NUMBER';
210
+ const IS_VALID_CARD_NUMBER_ERROR = 'error/IS_VALID_CARD_NUMBER';
211
+ const isValidCardNumber = createValidator(
212
+ IS_VALID_CARD_NUMBER,
213
+ IS_VALID_CARD_NUMBER_ERROR
214
+ );
215
+ validatorFns[IS_VALID_CARD_NUMBER] = (value) => {
216
+ if (value === '') {
217
+ return true;
218
+ }
219
+ return luhnValid(value);
220
+ };
221
+
209
222
  const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
210
223
  const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
211
224
  const numberLessThan = createValidator(
@@ -806,6 +819,7 @@ exports.includesPotentialCardNumber = includesPotentialCardNumber;
806
819
  exports.isAmericanOrCanadianRoutingNumber = isAmericanOrCanadianRoutingNumber;
807
820
  exports.isProbablyEmail = isProbablyEmail;
808
821
  exports.isRoutingNumber = isRoutingNumber;
822
+ exports.isValidCardNumber = isValidCardNumber;
809
823
  exports.isValidMonth = isValidMonth;
810
824
  exports.matchesField = matchesField;
811
825
  exports.matchesRegex = matchesRegex;
@@ -202,6 +202,19 @@ validatorFns[INCLUDES_POTENTIAL_CARD_NUMBER] = (value) => {
202
202
  return !(luhnValid(value) && regex.test(value));
203
203
  };
204
204
 
205
+ const IS_VALID_CARD_NUMBER = 'validator/IS_VALID_CARD_NUMBER';
206
+ const IS_VALID_CARD_NUMBER_ERROR = 'error/IS_VALID_CARD_NUMBER';
207
+ const isValidCardNumber = createValidator(
208
+ IS_VALID_CARD_NUMBER,
209
+ IS_VALID_CARD_NUMBER_ERROR
210
+ );
211
+ validatorFns[IS_VALID_CARD_NUMBER] = (value) => {
212
+ if (value === '') {
213
+ return true;
214
+ }
215
+ return luhnValid(value);
216
+ };
217
+
205
218
  const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
206
219
  const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
207
220
  const numberLessThan = createValidator(
@@ -789,4 +802,4 @@ const createFormState = (formConfig) => ({
789
802
  mapStateToProps: mapStateToProps,
790
803
  });
791
804
 
792
- export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, includedIn, includesPotentialCardNumber, isAmericanOrCanadianRoutingNumber, isProbablyEmail, isRoutingNumber, isValidMonth, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, onlyExpirationDate, onlyIntegers, onlyNaturals, required, validName, validateSum, validateWhen };
805
+ export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, includedIn, includesPotentialCardNumber, isAmericanOrCanadianRoutingNumber, isProbablyEmail, isRoutingNumber, isValidCardNumber, isValidMonth, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, onlyExpirationDate, onlyIntegers, onlyNaturals, required, validName, validateSum, validateWhen };
@@ -208,6 +208,19 @@
208
208
  return !(luhnValid(value) && regex.test(value));
209
209
  };
210
210
 
211
+ const IS_VALID_CARD_NUMBER = 'validator/IS_VALID_CARD_NUMBER';
212
+ const IS_VALID_CARD_NUMBER_ERROR = 'error/IS_VALID_CARD_NUMBER';
213
+ const isValidCardNumber = createValidator(
214
+ IS_VALID_CARD_NUMBER,
215
+ IS_VALID_CARD_NUMBER_ERROR
216
+ );
217
+ validatorFns[IS_VALID_CARD_NUMBER] = (value) => {
218
+ if (value === '') {
219
+ return true;
220
+ }
221
+ return luhnValid(value);
222
+ };
223
+
211
224
  const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
212
225
  const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
213
226
  const numberLessThan = createValidator(
@@ -808,6 +821,7 @@
808
821
  exports.isAmericanOrCanadianRoutingNumber = isAmericanOrCanadianRoutingNumber;
809
822
  exports.isProbablyEmail = isProbablyEmail;
810
823
  exports.isRoutingNumber = isRoutingNumber;
824
+ exports.isValidCardNumber = isValidCardNumber;
811
825
  exports.isValidMonth = isValidMonth;
812
826
  exports.matchesField = matchesField;
813
827
  exports.matchesRegex = matchesRegex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redux-freeform",
3
- "version": "6.2.2",
3
+ "version": "6.2.3",
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",