redux-freeform 5.9.0 → 5.9.1-beta.0

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.
@@ -480,6 +480,13 @@ validatorFns[VALID_NAME] = (value, args, form) =>
480
480
  ? false
481
481
  : new RegExp(/[A-zÀ-ÿ\-,'\S]+(\s?[A-zÀ-ÿ\-,'\S])*/).test(value);
482
482
 
483
+ const IS_AMEX_CARD = 'validator/IS_AMEX_CARD';
484
+ const IS_AMEX_CARD_ERROR = 'validator/IS_AMEX_CARD_ERROR';
485
+ const isAmexCard = createValidator(IS_AMEX_CARD, IS_AMEX_CARD_ERROR);
486
+ // Amex cards are 15 digits and start with the number '34' or '37'
487
+ validatorFns[IS_AMEX_CARD] = (value, args, form) =>
488
+ new RegExp(/^3[4|7]\d{13}$/).test(value);
489
+
483
490
  const runValidatorErrorMessage = (type) =>
484
491
  `${type} was passed to runValidator, but that validator type does not exist.
485
492
  Please check that you are only calling validator creator functions exported from
@@ -684,6 +691,7 @@ exports.hasNumber = hasNumber;
684
691
  exports.hasSpecialCharacter = hasSpecialCharacter;
685
692
  exports.hasUppercaseLetter = hasUppercaseLetter;
686
693
  exports.includedIn = includedIn;
694
+ exports.isAmexCard = isAmexCard;
687
695
  exports.isProbablyEmail = isProbablyEmail;
688
696
  exports.isRoutingNumber = isRoutingNumber;
689
697
  exports.isValidMonth = isValidMonth;
@@ -476,6 +476,13 @@ validatorFns[VALID_NAME] = (value, args, form) =>
476
476
  ? false
477
477
  : new RegExp(/[A-zÀ-ÿ\-,'\S]+(\s?[A-zÀ-ÿ\-,'\S])*/).test(value);
478
478
 
479
+ const IS_AMEX_CARD = 'validator/IS_AMEX_CARD';
480
+ const IS_AMEX_CARD_ERROR = 'validator/IS_AMEX_CARD_ERROR';
481
+ const isAmexCard = createValidator(IS_AMEX_CARD, IS_AMEX_CARD_ERROR);
482
+ // Amex cards are 15 digits and start with the number '34' or '37'
483
+ validatorFns[IS_AMEX_CARD] = (value, args, form) =>
484
+ new RegExp(/^3[4|7]\d{13}$/).test(value);
485
+
479
486
  const runValidatorErrorMessage = (type) =>
480
487
  `${type} was passed to runValidator, but that validator type does not exist.
481
488
  Please check that you are only calling validator creator functions exported from
@@ -671,4 +678,4 @@ const createFormState = (formConfig) => ({
671
678
  mapStateToProps: mapStateToProps,
672
679
  });
673
680
 
674
- export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, includedIn, isProbablyEmail, isRoutingNumber, isValidMonth, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, onlyExpirationDate, onlyIntegers, onlyNaturals, required, validName, validateSum, validateWhen };
681
+ export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, includedIn, isAmexCard, isProbablyEmail, isRoutingNumber, isValidMonth, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, onlyExpirationDate, onlyIntegers, onlyNaturals, required, validName, validateSum, validateWhen };
@@ -482,6 +482,13 @@
482
482
  ? false
483
483
  : new RegExp(/[A-zÀ-ÿ\-,'\S]+(\s?[A-zÀ-ÿ\-,'\S])*/).test(value);
484
484
 
485
+ const IS_AMEX_CARD = 'validator/IS_AMEX_CARD';
486
+ const IS_AMEX_CARD_ERROR = 'validator/IS_AMEX_CARD_ERROR';
487
+ const isAmexCard = createValidator(IS_AMEX_CARD, IS_AMEX_CARD_ERROR);
488
+ // Amex cards are 15 digits and start with the number '34' or '37'
489
+ validatorFns[IS_AMEX_CARD] = (value, args, form) =>
490
+ new RegExp(/^3[4|7]\d{13}$/).test(value);
491
+
485
492
  const runValidatorErrorMessage = (type) =>
486
493
  `${type} was passed to runValidator, but that validator type does not exist.
487
494
  Please check that you are only calling validator creator functions exported from
@@ -686,6 +693,7 @@
686
693
  exports.hasSpecialCharacter = hasSpecialCharacter;
687
694
  exports.hasUppercaseLetter = hasUppercaseLetter;
688
695
  exports.includedIn = includedIn;
696
+ exports.isAmexCard = isAmexCard;
689
697
  exports.isProbablyEmail = isProbablyEmail;
690
698
  exports.isRoutingNumber = isRoutingNumber;
691
699
  exports.isValidMonth = isValidMonth;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redux-freeform",
3
- "version": "5.9.0",
3
+ "version": "5.9.1-beta.0",
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",